Mar*_*vin 1 time-series statsmodels
我正在尝试SARIMAX将 34 个元素的每月时间序列扩展到 35 个元素,假设有 12 个月的季节性成分。
但是,该predict方法因回溯而失败:
<ipython-input-40-151295bf5e3e> in approach_4_stationarity(data_file_name)
27 sarima = SARIMAX( total_items_array, order = ( 1, 0, 0 ), seasonal_order = (0,0,0,12) )
28 sarima.fit()
---> 29 next_month_item_cnt = sarima.predict( (1, 0, 0 ), start = 34, end = 34 )
30 print( "next_month_item_cnt", next_month_item_cnt, file = sys.stderr )
31 total_items_array = total_items_array.append( next_month_item_cnt )
/opt/conda/lib/python3.6/site-packages/statsmodels/base/model.py in predict(self, params, exog, *args, **kwargs)
205 This is a placeholder intended to be overwritten by individual models.
206 """
--> 207 raise NotImplementedError
208
209
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
该fit方法不会影响模型对象,它返回一个新的结果对象。您可能想要如下所示的内容:
model = SARIMAX(total_items_array, order=(1, 0, 0), seasonal_order=(0,0,0,12))
results = model.fit()
next_month_item_cnt = results.forecast(steps=1)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1562 次 |
| 最近记录: |