所以我试图获得 5 个 arima 模型(预测未来 1 到 5 天)。如果我使用 d>0 或 q>0,则使用 statsmodels arima 类无法正常工作。使用自动 arima 其工作 (pmdarima)。
例如(统计模型)
p,d,q = 1, 1, 0
models = []
for dayidx in range(0,5):
models.append(ARIMA(exog=X_train[dayidx], endog=y_train[dayidx],order=(p,d,q)).fit())
models[0].forecast(exog=X_test[0],steps=157)[0]
如果我使用 p>0、d>0 和 q=0 的预测,我得到的不是预期的目标值(只是增加的值,比如 x2-x10 更高)。如果我使用预测 p>0, d=0, q=0 我会得到可取的值。如果我对 qi 使用任何值,则会出现以下错误,这告诉我数据是非平稳的,为什么我在使用 q>0 的情况下使用 d>0 并且它应该可以工作,但它确实...
The computed initial AR coefficients are not stationary
You should induce stationarity, choose a different model order, or you can
pass your own start_params.
这里是 pmarima 模型的代码
auto_arima = {'adf': [], 'kpss': []}
stattests = ('adf','kpss')
for stattest in stattests:
print(stattest)
for dayidx in range(0,5):
auto_arima[stattest].append(pm.auto_arima(y=y_train[dayidx], exogenous=X_train[dayidx],
stepwise=True,
suppress_warnings=True,
error_action="ignore",
test=stattest,
start_p=0,
start_d=0,
start_q=0,
max_p=6,
max_d=3,
max_q=3,
max_order=None,
trace=False))
print('done')
使用 Auto Arima (pmdarima) 可以正常工作(我从 d -> d>0 得到值)
Training with adf
(1, 0, 1)
(4, 0, 1)
(1, 0, 1)
(2, 0, 2)
(2, 0, 0)
Training with kpss
(1, 1, 2)
(1, 1, 2)
(2, 1, 1)
(1, 1, 2)
(2, 1, 1)
这些是用于训练 arima 模型的参数 (pmarima)。所以q应该>0
有谁知道为什么来自 statsmodels 的 ARIMA 对我不起作用,但来自 pmarima 的 autoarima 是?