-
Notifications
You must be signed in to change notification settings - Fork 0
/
double_logistic.hpp
77 lines (58 loc) · 2.26 KB
/
double_logistic.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef DOUBLE_LOGISTIC_HPP
#define DOUBLE_LOGISTIC_HPP
#include "../ATL/ATL.hpp"
#include "../functional_analysis.hpp"
template<typename T>
class DoubleLogistic : public FunctionalAnalysis<T> {
public:
typedef typename FunctionalAnalysis<double>::Variable Variable;
Variable median_asc;
Variable slope_asc;
Variable median_desc;
Variable slope_desc;
Variable X;
DoubleLogistic() {
}
virtual void Initialize() {
this->name = "double_logistic";
this->description = "Functional analysis of the double logistic function.";
this->median_asc.SetName("median_asc");
this->median_asc.SetBounds(1.0, 5.0);
this->RegisterParameter(this->median_asc, 0.1);
this->slope_asc.SetName("slope_asc");
this->slope_asc.SetBounds(0.1, 0.3);
this->RegisterParameter(this->slope_asc, 0.01);
this->median_desc.SetName("median_desc");
this->median_desc.SetBounds(5.0, 10.0);
this->RegisterParameter(this->median_desc, 0.1);
this->slope_desc.SetName("slope_desc");
this->slope_desc.SetBounds(0.1, 0.3);
this->RegisterParameter(this->slope_desc, 0.01);
this->X.SetBounds(1, 10);
this->X.SetName("X");
this->RegisterParameter(this->X, 1.0);
}
/**
* @brief The general double logistic function
*
* \f$ \frac{1.0}{ 1.0 + exp(-1.0 * slope_{asc} (x - median_{asc}))}
* \left(1-\frac{1.0}{ 1.0 + exp(-1.0 * slope_{desc} (x - median_{desc}))}
* \right)\f$
*
* @param median_asc the median (inflection point) of the ascending limb of the
* double logistic function
* @param slope_asc the slope of the ascending limb of the double logistic
* function
* @param median_desc the median (inflection point) of the descending limb of
* the double logistic function, where median_desc > median_asc
* @param slope_desc the slope of the descending limb of the double logistic
* function
* @param x the index the logistic function should be evaluated at
* @return
*/
virtual Variable Evaluate() {
return (1.0) / (1.0 + exp(-1.0 * slope_asc * (X - median_asc))) *
(1.0 - (1.0) / (1.0 + exp(-1.0 * slope_desc * (X - median_desc))));
}
};
#endif