20#ifndef INTERPOLARIMA_H
21#define INTERPOLARIMA_H
26 #pragma GCC diagnostic push
27 #pragma GCC diagnostic ignored "-Wpedantic"
28 #include <meteoio/thirdParty/ctsa.h>
29 #pragma GCC diagnostic pop
30#elif defined __clang__
31 #pragma clang diagnostic push
32 #pragma clang diagnostic ignored "-Wpedantic"
33 #include <meteoio/thirdParty/ctsa.h>
34 #pragma clang diagnostic pop
36 #include <meteoio/thirdParty/ctsa.h>
47using namespace ARIMAutils;
107 InterpolARIMA(std::vector<double> data_in,
size_t gap_loc,
size_t N_gap,
int s = 0);
108 InterpolARIMA(std::vector<double> data_in,
size_t gap_loc,
size_t N_gap, std::vector<double> xreg_vec,
int s = 0);
109 InterpolARIMA(std::vector<double> data_in,
size_t gap_loc,
size_t n_predictions, std::string direction =
"forward",
int s = 0);
112 void setAutoArimaMetaData(
int max_p_param = 8,
int max_d_param = 3,
int max_q = 8,
int start_p = 2,
int start_q = 2,
int max_P = 2,
113 int max_D = 1,
int max_Q = 2,
int start_P = 1,
int start_Q = 1,
bool seasonal =
true,
114 bool stationary =
false);
116 bool approximation =
false,
int num_models = 94);
119 void setManualARIMA(
int p,
int d,
int q,
int P,
int D,
int Q,
bool fill_backward);
122 std::vector<double>
simulate(
int n_steps,
int seed = 0);
127 std::vector<double>
predict(
size_t n_steps = 0);
139 : norm(other.norm), data(other.data), gap_loc(other.gap_loc), N_gap(other.N_gap), time(other.time), pred_forward(other.pred_forward),
140 pred_backward(other.pred_backward), xreg_vec_f(other.xreg_vec_f), xreg_vec_b(other.xreg_vec_b),
141 data_forward(other.data_forward), data_backward(other.data_backward), new_xreg_vec_f(other.new_xreg_vec_f),
142 new_xreg_vec_b(other.new_xreg_vec_b), xreg_f((xreg_vec_f.empty()) ? nullptr : &xreg_vec_f[0]),
143 xreg_b((xreg_vec_b.empty()) ? nullptr : &xreg_vec_b[0]), new_xreg_f((new_xreg_vec_f.empty()) ? nullptr : &new_xreg_vec_f[0]),
144 new_xreg_b((new_xreg_vec_b.empty()) ? nullptr : &new_xreg_vec_b[0]), amse_forward(other.amse_forward),
145 amse_backward(other.amse_backward), N_data_forward(other.N_data_forward), N_data_backward(other.N_data_backward),
146 max_p(other.max_p), max_d(other.max_d), max_q(other.max_q), start_p(other.start_p), start_q(other.start_q),
147 max_P(other.max_P), max_D(other.max_D), max_Q(other.max_Q), start_P(other.start_P), start_Q(other.start_Q), r(other.r),
148 s(other.s), method(other.method), opt_method(other.opt_method), stepwise(other.stepwise), approximation(other.approximation),
149 num_models(other.num_models), seasonal(other.seasonal), stationary(other.stationary),
157 if (
this != &other) {
162 gap_loc = other.gap_loc;
165 pred_forward = other.pred_forward;
166 pred_backward = other.pred_backward;
169 xreg_vec_f = other.xreg_vec_f;
170 xreg_vec_b = other.xreg_vec_b;
171 data_forward = other.data_forward;
172 data_backward = other.data_backward;
173 new_xreg_vec_f = other.new_xreg_vec_f;
174 new_xreg_vec_b = other.new_xreg_vec_b;
175 N_data_forward = other.N_data_forward;
176 N_data_backward = other.N_data_backward;
180 start_p = other.start_p;
181 start_q = other.start_q;
185 start_P = other.start_P;
186 start_Q = other.start_Q;
189 method = other.method;
190 opt_method = other.opt_method;
191 stepwise = other.stepwise;
192 approximation = other.approximation;
193 num_models = other.num_models;
194 seasonal = other.seasonal;
195 stationary = other.stationary;
198 xreg_f = (xreg_vec_f.empty()) ?
nullptr : &xreg_vec_f[0];
199 xreg_b = (xreg_vec_b.empty()) ?
nullptr : &xreg_vec_b[0];
200 new_xreg_f = (new_xreg_vec_f.empty()) ?
nullptr : &new_xreg_vec_f[0];
201 new_xreg_b = (new_xreg_vec_b.empty()) ?
nullptr : &new_xreg_vec_b[0];
224 std::vector<double> data;
227 std::vector<double> time;
228 std::vector<double> pred_forward, pred_backward;
232 std::vector<double> xreg_vec_f, xreg_vec_b, data_forward, data_backward, new_xreg_vec_f, new_xreg_vec_b;
237 std::vector<double> amse_forward, amse_backward;
238 size_t N_data_forward, N_data_backward;
239 int max_p = 8, max_d = 3, max_q = 8;
240 int start_p = 2, start_q = 2;
241 int max_P = 2, max_D = 1, max_Q = 2;
242 int start_P = 1, start_Q = 1;
245 bool stepwise =
true, approximation =
true;
247 bool seasonal =
true, stationary =
false;
249 bool consistencyCheck();
250 auto_arima_object initAutoArima(
size_t N_data);
259 bool set_manual =
false;
260 bool fill_backward_manual =
false;
Definition: ARIMAutils.h:55
std::vector< double > denormalize(const std::vector< double > &data)
Definition: ARIMAutils.cc:80
Mode
Definition: ARIMAutils.h:57
This class is used for interpolating or predicting missing data in a time series using the Auto ARIMA...
Definition: InterpolARIMA.h:104
std::string toString()
Definition: InterpolARIMA.cc:129
sarima_object sarima_forward
Definition: InterpolARIMA.h:263
InterpolARIMA & operator=(const InterpolARIMA &other)
Definition: InterpolARIMA.h:155
InterpolARIMA()
Definition: InterpolARIMA.cc:34
std::vector< double > getBackwardData()
Definition: InterpolARIMA.h:134
std::vector< double > getForwardData()
Definition: InterpolARIMA.h:133
void fillGap()
Definition: InterpolARIMA.cc:428
~InterpolARIMA()
Definition: InterpolARIMA.h:207
std::vector< double > simulate(int n_steps, int seed=0)
Definition: InterpolARIMA.cc:393
void setAutoArimaMetaData(int max_p_param=8, int max_d_param=3, int max_q=8, int start_p=2, int start_q=2, int max_P=2, int max_D=1, int max_Q=2, int start_P=1, int start_Q=1, bool seasonal=true, bool stationary=false)
Definition: InterpolARIMA.cc:312
InterpolARIMA(const InterpolARIMA &other)
Definition: InterpolARIMA.h:138
auto_arima_object auto_arima_forward
Definition: InterpolARIMA.h:254
std::vector< double > ARIMApredict(size_t n_steps)
Definition: InterpolARIMA.cc:401
std::vector< double > getData()
Definition: InterpolARIMA.h:132
void setManualARIMA(int p, int d, int q, int P, int D, int Q, bool fill_backward)
Definition: InterpolARIMA.cc:375
void interpolate()
Definition: InterpolARIMA.cc:543
void fillGapManual()
Definition: InterpolARIMA.cc:471
void setNormalizationMode(Normalization::Mode mode)
Definition: InterpolARIMA.cc:298
std::vector< double > getInterpolatedData()
Definition: InterpolARIMA.cc:386
void setOptMetaData(ObjectiveFunction method=CSS_MLE, OptimizationMethod opt_method=BFGS, bool stepwise=true, bool approximation=false, int num_models=94)
Definition: InterpolARIMA.cc:356
std::vector< double > predict(size_t n_steps=0)
Definition: InterpolARIMA.cc:568
std::string autoArimaInfo(auto_arima_object obj)
Definition: InterpolARIMA.cc:175
void setVerbose(bool verbose=false)
Definition: InterpolARIMA.cc:370
auto_arima_object auto_arima_backward
Definition: InterpolARIMA.h:255
OptimizationMethod
Definition: ARIMAutils.h:41
@ BFGS
Definition: ARIMAutils.h:47
ObjectiveFunction
Definition: ARIMAutils.h:34
@ CSS_MLE
Definition: ARIMAutils.h:35