Statsmodels ARIMA:每个预测的恒定值 [英] Statsmodels ARIMA: Constant Value for Each Forecast
问题描述
我正在尝试使用 statsmodels 的 ARIMA 来预测时间序列.我正在使用 sklearn 的 TimeSeriesSplit
来评估我的模型.不幸的是,当我预测下一个数据折叠(具有真实值 Y_test
)时,我得到了一个恒定的预测:
I'm trying to use statsmodels' ARIMA to forecast a time series. I'm using sklearn's TimeSeriesSplit
to evaluate my models. Unfortunately, when I forecast the next fold of data (which has true value Y_test
), I get a constant prediction:
if is_arima:
Y_train = Y_train.astype(float)
# build basic ARIMA model
arima_model = ARIMA(Y_train, order=(2,0,1))
# fit it, using exogenous variables
arima_results = arima_model.fit()
# predict next len(test) values, using exogenous variables (X_test)
preds = arima_results.forecast(steps=len(Y_test))[0]
print(preds)
这给了我:
115.65096239 120.89113477 121.52020239 121.59572014 121.60478583
121.60587414 121.60600479 121.60602047 121.60602235 121.60602258
121.6060226 121.60602261 121.60602261 121.60602261 121.60602261
121.60602261 121.60602261 121.6060226 121.6060226 121.6060226
121.6060226 121.6060226 121.6060226 121.6060226 121.6060226
121.6060226 121.6060226 121.6060226 121.6060226 121.6060226...
这让我觉得我的 ARIMA 没有将时间 t 的预测用于时间 t+1 的预测?
This makes me think my ARIMA isn't using the prediction at time t for its prediction at time t+1?
我知道输出不是完全恒定的,但我的数据集显示出很大的变化,所以这有点令人担忧.知道发生了什么吗?
I understand the output isn't perfectly constant but my dataset shows large variation, so this is mildly concerning. Any idea what's going on?
谢谢!
推荐答案
您正在使用递归策略进行多步预测,即在先前步骤中生成的预测用于迭代预测下一个预测.它导致错误累积,结果预测收敛到一个值.对于很长的数据系列,Arima 表现不佳.
You are making use of recursive strategy to do multi step prediction i.e. forecasts generated in the prior steps are used for the prediction of next forecasts iteratively. It leads to error accumulation and as a result forecasting converges to a value. Arima does not perform well for very long data series.
这篇关于Statsmodels ARIMA:每个预测的恒定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!