statsmodels.api.tsa.get_forcast的参数是什么?

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

我想使用Python的statsmodels.api.tsa.get_forcast从样本中预测数据,这是我的代码:

mod=sm.tsa.SARIMAX(hs300['Close'],order=(2,1,2),seasonal_order=(2,1,2,12),enforce_stationarity=False,enforce_invertibility=False)
result=mod.fit()
pred=result.get_forcast(20)

我想从样本中获取未来20天的数据,这是我的错误:

TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'

我该如何解决这个问题?我找到了此功能的文档,但是此文件没有为我提供此功能的足够信息:

get_forecast(steps=1, **kwargs) method of statsmodels.tsa.statespace.sarimax.SARIMAXResults instance
Out-of-sample forecasts

Parameters
----------
steps : int, str, or datetime, optional
    If an integer, the number of steps to forecast from the end of the
    sample. Can also be a date string to parse or a datetime type.
    However, if the dates index does not have a fixed frequency, steps
    must be an integer. Default
**kwargs
    Additional arguments may required for forecasting beyond the end
    of the sample. See `FilterResults.predict` for more details.

没有该函数的示例,谁可以为此函数提供实例?

python python-3.x statsmodels
1个回答
-1
投票

看起来您的代码中有一个简单的拼写错误。

pred=result.get_forcast(20)更改为pred=result.get_forecast(20),否则执行pred=result.get_forecast(steps=20)

© www.soinside.com 2019 - 2024. All rights reserved.