问题描述
我正在尝试使用 ExponentialSmoothing
中的 statsmodels.tsa.holtwinters
预测时间序列。
Statsmodels documentation 提到了一个名为 exog_names
的属性,它提供了外生变量的名称,但没有关于如何将外生数据传递给模型的信息。
我尝试使用以下代码片段:
import pandas as pd
import numpy as np
import itertools
from statsmodels.tsa.holtwinters import ExponentialSmoothing
#HW model setup
HW = ExponentialSmoothing(df["Number of Cars"],trend='add',seasonal='add',seasonal_periods = 2)
#Setting exogenous variables
HW.exog = exog_data[["GDP","Fuel Price"]]
HW_Model = HW.fit()
#Forecasting
HW_Model.forecast(5)
当我执行 HW.exog
时,我会同时得到“GDP”和“燃料价格”。
但是,当我执行 HW.exog_names
时,不会返回“GDP”和“燃料价格”。这是在 Python 中的 Statsmodel Holt Winters 实现中包含外生数据的正确方法吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)