训练ARIMA以预测趋势

问题描述 投票:0回答:1

我正在尝试使用ARIMA预测趋势。不幸的是,我得到的输出与预期的输出相差甚远(训练和测试数据的行为非常相似),并表明好像整个训练数据集都...无用?

df = pd.read_csv('data.csv')
df.index = pd.DatetimeIndex(df.index).to_period('D')

#data from 1/1/2016 to 31/12/2018
train = df.loc[:'2018-12-31']
test = df.loc['2019-01-01':]

model = auto_arima(train, start_p=1, start_q=1,
                   max_p=3, max_q=3, m=7,
                   start_P=0, seasonal=True,
                   d=1, D=1, trace=True,
                   error_action='ignore',
                   suppress_warnings=True,
                   stepwise=True)

model.aic()
model.fit(train)
ffforecast = model.predict(n_periods=len(test))
ffforecast = pd.DataFrame(fforecast,
                               index=test.index,
                               columns=['prediction'])
pd.concat([test, fforecast], axis=1).plot()
pyplot.show()

enter image description here

完整代码:https://pastebin.com/huer62cM

csv:https://filebin.net/rlvm3hrjetlovd64/newbikes6years.csv?t=nt3slw3y

python arima
1个回答
0
投票
您为模型使用了一组错误的参数。似乎您从其他数据集中复制/粘贴了示例,但对您不起作用。
© www.soinside.com 2019 - 2024. All rights reserved.