我一直对 statsmodels 的 ExponentialSmoothing 模块有一个令人沮丧的问题。
我的数据是一个熊猫系列,每周有 74 个数据点,如下所示:
2017-12-31 6069
2018-01-07 8143
2018-01-14 6740
2018-01-21 6433
2018-01-28 6631
2018-02-04 6308
2018-02-11 5536
2018-02-18 6025
2018-02-25 5171
... ...
当我调用以下函数时:
model = ExponentialSmoothing(data, trend='add',damped=True,seasonal='mul',seasonal_periods=52)
model_fit = model.fit()
我得到:
Traceback (most recent call last):
File ".\smoothingjuly.py", line 24, in <module>
model_fit = model.fit()
File "C:\Users\lhughes\AppData\Local\Programs\Python\Python37\lib\site-packages\statsmodels\tsa\holtwinters.py", line 641, in fit
l0, b0, s0 = self.initial_values()
File "C:\Users\lhughes\AppData\Local\Programs\Python\Python37\lib\site-packages\statsmodels\tsa\holtwinters.py", line 773, in initial_values
b0 = ((lead - lag) / m).mean()
ValueError: operands could not be broadcast together with shapes (22,) (52,)
为什么是这样?如果我减少季节性周期的数量,它会起作用,但这会使我的模型无用。74 个数据点对模型来说还不够吗?如果是这样,最低限度是多少?
谢谢