20#ifndef INTERPOLARIMA_H
21#define INTERPOLARIMA_H
25#include <meteoio/thirdParty/ctsa.h>
32 using namespace ARIMAutils;
92 InterpolARIMA(std::vector<double> data_in,
size_t gap_loc,
size_t N_gap,
int s = 0);
93 InterpolARIMA(std::vector<double> data_in,
size_t gap_loc,
size_t N_gap, std::vector<double> xreg_vec,
int s = 0);
94 InterpolARIMA(std::vector<double> data_in,
size_t gap_loc,
size_t n_predictions, std::string direction =
"forward",
int s = 0);
97 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,
98 int max_D = 1,
int max_Q = 2,
int start_P = 1,
int start_Q = 1,
bool seasonal =
true,
99 bool stationary =
false);
101 bool approximation =
false,
int num_models = 94);
104 void setManualARIMA(
int p,
int d,
int q,
int P,
int D,
int Q,
bool fill_backward);
107 std::vector<double>
simulate(
int n_steps,
int seed = 0);
112 std::vector<double>
predict(
size_t n_steps = 0);
124 : norm(other.norm), data(other.data), gap_loc(other.gap_loc), N_gap(other.N_gap), time(other.time), pred_forward(other.pred_forward),
125 pred_backward(other.pred_backward), xreg_vec_f(other.xreg_vec_f), xreg_vec_b(other.xreg_vec_b),
126 data_forward(other.data_forward), data_backward(other.data_backward), new_xreg_vec_f(other.new_xreg_vec_f),
127 new_xreg_vec_b(other.new_xreg_vec_b), xreg_f((xreg_vec_f.empty()) ? nullptr : &xreg_vec_f[0]),
128 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]),
129 new_xreg_b((new_xreg_vec_b.empty()) ? nullptr : &new_xreg_vec_b[0]), amse_forward(other.amse_forward),
130 amse_backward(other.amse_backward), N_data_forward(other.N_data_forward), N_data_backward(other.N_data_backward),
131 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),
132 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),
133 s(other.s), method(other.method), opt_method(other.opt_method), stepwise(other.stepwise), approximation(other.approximation),
134 num_models(other.num_models), seasonal(other.seasonal), stationary(other.stationary),
147 gap_loc = other.gap_loc;
150 pred_forward = other.pred_forward;
151 pred_backward = other.pred_backward;
154 xreg_vec_f = other.xreg_vec_f;
155 xreg_vec_b = other.xreg_vec_b;
156 data_forward = other.data_forward;
157 data_backward = other.data_backward;
158 new_xreg_vec_f = other.new_xreg_vec_f;
159 new_xreg_vec_b = other.new_xreg_vec_b;
160 N_data_forward = other.N_data_forward;
161 N_data_backward = other.N_data_backward;
165 start_p = other.start_p;
166 start_q = other.start_q;
170 start_P = other.start_P;
171 start_Q = other.start_Q;
174 method = other.method;
175 opt_method = other.opt_method;
176 stepwise = other.stepwise;
177 approximation = other.approximation;
178 num_models = other.num_models;
179 seasonal = other.seasonal;
180 stationary = other.stationary;
183 xreg_f = (xreg_vec_f.empty()) ?
nullptr : &xreg_vec_f[0];
184 xreg_b = (xreg_vec_b.empty()) ?
nullptr : &xreg_vec_b[0];
185 new_xreg_f = (new_xreg_vec_f.empty()) ?
nullptr : &new_xreg_vec_f[0];
186 new_xreg_b = (new_xreg_vec_b.empty()) ?
nullptr : &new_xreg_vec_b[0];
209 std::vector<double> data;
212 std::vector<double> time;
213 std::vector<double> pred_forward, pred_backward;
217 std::vector<double> xreg_vec_f, xreg_vec_b, data_forward, data_backward, new_xreg_vec_f, new_xreg_vec_b;
222 std::vector<double> amse_forward, amse_backward;
223 size_t N_data_forward, N_data_backward;
224 int max_p = 8, max_d = 3, max_q = 8;
225 int start_p = 2, start_q = 2;
226 int max_P = 2, max_D = 1, max_Q = 2;
227 int start_P = 1, start_Q = 1;
230 bool stepwise =
true, approximation =
true;
232 bool seasonal =
true, stationary =
false;
234 bool consistencyCheck();
235 auto_arima_object initAutoArima(
size_t N_data);
244 bool set_manual =
false;
245 bool fill_backward_manual =
false;
Definition: ARIMAutils.h:52
std::vector< double > denormalize(const std::vector< double > &data)
Definition: ARIMAutils.cc:50
Mode
Definition: ARIMAutils.h:54
This class is used for interpolating or predicting missing data in a time series using the Auto ARIMA...
Definition: InterpolARIMA.h:89
std::string toString()
Definition: InterpolARIMA.cc:115
sarima_object sarima_forward
Definition: InterpolARIMA.h:248
InterpolARIMA & operator=(const InterpolARIMA &other)
Definition: InterpolARIMA.h:140
InterpolARIMA()
Definition: InterpolARIMA.cc:34
std::vector< double > getBackwardData()
Definition: InterpolARIMA.h:119
std::vector< double > getForwardData()
Definition: InterpolARIMA.h:118
void fillGap()
Definition: InterpolARIMA.cc:422
~InterpolARIMA()
Definition: InterpolARIMA.h:192
std::vector< double > simulate(int n_steps, int seed=0)
Definition: InterpolARIMA.cc:382
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:301
InterpolARIMA(const InterpolARIMA &other)
Definition: InterpolARIMA.h:123
auto_arima_object auto_arima_forward
Definition: InterpolARIMA.h:239
std::vector< double > ARIMApredict(size_t n_steps)
Definition: InterpolARIMA.cc:390
std::vector< double > getData()
Definition: InterpolARIMA.h:117
void setManualARIMA(int p, int d, int q, int P, int D, int Q, bool fill_backward)
Definition: InterpolARIMA.cc:364
void interpolate()
Definition: InterpolARIMA.cc:571
void fillGapManual()
Definition: InterpolARIMA.cc:489
void setNormalizationMode(Normalization::Mode mode)
Definition: InterpolARIMA.cc:287
std::vector< double > getInterpolatedData()
Definition: InterpolARIMA.cc:375
void setOptMetaData(ObjectiveFunction method=CSS_MLE, OptimizationMethod opt_method=BFGS, bool stepwise=true, bool approximation=false, int num_models=94)
Definition: InterpolARIMA.cc:345
std::vector< double > predict(size_t n_steps=0)
Definition: InterpolARIMA.cc:606
std::string autoArimaInfo(auto_arima_object obj)
Definition: InterpolARIMA.cc:164
void setVerbose(bool verbose=false)
Definition: InterpolARIMA.cc:359
auto_arima_object auto_arima_backward
Definition: InterpolARIMA.h:240
OptimizationMethod
Definition: ARIMAutils.h:39
@ BFGS
Definition: ARIMAutils.h:45
ObjectiveFunction
Definition: ARIMAutils.h:34
@ CSS_MLE
Definition: ARIMAutils.h:35