我正在尝试使用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()
完整代码:https://pastebin.com/huer62cM
csv:https://filebin.net/rlvm3hrjetlovd64/newbikes6years.csv?t=nt3slw3y