OpenANN
1.1.0
An open source library for artificial neural networks.
Main Page
Classes
Files
List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
polebalancing
DoubleExponentialSmoothing.h
Go to the documentation of this file.
1
#ifndef DOUBLE_EXPONENTIAL_SMOOTHING_H_
2
#define DOUBLE_EXPONENTIAL_SMOOTHING_H_
3
4
#include <Eigen/Core>
5
#include <
OpenANN/io/Logger.h
>
6
7
class
DoubleExponentialSmoothing
8
{
10
double
alpha;
12
double
beta;
14
double
xc;
16
double
xn;
18
double
sc;
20
double
sn;
22
double
bc;
24
double
bn;
26
int
t;
27
28
public
:
29
DoubleExponentialSmoothing
()
30
: alpha(0.9), beta(0.9), sc(0.0), sn(0.0), bc(0.0), bn(0.0)
31
{
32
restart
();
33
}
34
35
void
restart
()
36
{
37
xc = 0.0;
38
xn = 0.0;
39
t = 0;
40
}
41
42
Eigen::VectorXd
operator()
(
double
in)
43
{
44
xc = xn;
45
xn = in;
46
sc = sn;
47
bc = bn;
48
if
(t == 0)
49
{
50
sn = in;
51
bn = 0.0;
52
}
53
else
if
(t == 1)
54
{
55
sn = xc;
56
bn = xn - xc;
57
}
58
else
59
{
60
sn = alpha * xn + (1.0 - alpha) * (sc + bc);
61
bn = beta * (sn - sc) + (1.0 - beta) * bc;
62
}
63
t++;
64
Eigen::VectorXd out(2);
65
out << sn + bn, bn;
// Forcast
66
return
out;
67
}
68
};
69
70
#endif // DOUBLE_EXPONENTIAL_SMOOTHING_H_
Generated on Wed Jul 9 2014 08:57:52 for OpenANN by
1.8.4