[英]python statsmodels ARIMA plot_predict: How to get the data predicted?
我使用 ARIMAResults 的plot_predict
函數提前 5 年預測數據的樣子,這是相當合理的。 唯一的問題是,我需要為 Power Bi 預測的數據!
我如何才能真正看到這些值(不在情節上)?
注意:我正在使用 python!
謝謝!
您需要調用predict()
方法而不是plot_predict()
。 它或多或少是具有相同參數的相同方法,但predict()
將預測值作為數組返回,而plot_predict()
返回一個數字。
使用 predict 而不是 predict_plot()
print("Predicted Price pct change")
def plotARMA(df_accumulative,ax,label):
result=df_accumulative
result=result.rolling(window=45).mean().dropna()
mod = sm.tsa.arima.ARIMA(result, order=(2,0,0))
res = mod.fit()
# Plot the original series and the forecasted series
#res.plot_predict(start=0, end=400)
df_accumulative.plot(ax=ax,label=label)
res.predict().plot(ax=ax,label=label)
fig,ax = plt.subplots(figsize=(20,20))
plotARMA(duke_accumulative,ax,"Duke")
plotARMA(nee_accumulative,ax,"Next Era")
plotARMA(xel_accumulative,ax,"Xel")
plt.legend(fontsize=8)
plt.title("ARMA")
plt.show()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.