【问题标题】:different result from model_fit.plot_predict() and model_fit.predict() from arima来自 arima 的 model_fit.plot_predict() 和 model_fit.predict() 的不同结果
【发布时间】:2021-06-16 17:54:18
【问题描述】:

我想通过使用预测值和实际值之间的差异来了解 arima 如何运作良好。所以我使用了 predict()(下一个),但它与 plot_predict()(上一个)的值不同。 (请看看有什么不同)enter image description here 我认为 plot_predict 值是我想要的,因为它更接近真实值,但我从 predict() 得到的值太低了。请帮我找到答案。感谢您的帮助。

第一个,我用过

from statsmodels.tsa.arima_model import ARIMA

model = ARIMA(sales, order=(0,1,1))
model_fit = model.fit(trend='nc',full_output=True, disp=1)
print(model_fit.summary())
model_fit.plot_predict(dynamic=False)

下面这个我用过

predict=model_fit.predict()
plt.plot(predict) 

【问题讨论】:

    标签: python time-series forecasting predict arima


    【解决方案1】:

    您使用哪个版本的statsmodels

    我认为您使用的是 statsmodels 版本 10.2(目前是 Google Colab 中 statsmodels 的默认版本)

    注意函数中的typ参数(described in this link),将值改为levels,得到预测值而不是差分值。

    predict=model_fit.predict(typ='levels')
    plt.plot(predict)
    plt.plot(sales)
    

    【讨论】:

      猜你喜欢
      • 2018-01-17
      • 2016-08-13
      • 2012-12-21
      • 2020-03-17
      • 1970-01-01
      • 2022-01-05
      • 1970-01-01
      • 2021-03-07
      • 1970-01-01
      相关资源
      最近更新 更多