我已经通过脚本中的Statsmodels实现了Holt-Winters模型,可以对其进行预测,但是我手动设置了alpha beta和gamma超参数。根据您的说法,用我的数据集获取那些参数的理想值的最快方法是什么,以及如何实现它?像Auto Arima一样,Holt-Winters是否有任何自动优化?您可以在下面找到我的Python代码:
示例文件:
from statsmodels.tsa.api import ExponentialSmoothing
import pandas as pd
import numpy as np
df = pd.read_excel("C:\\Users\\YannickLECROART\\Documents\\Python\\temprennes.xlsx", index_col=0)
df = df.fillna(0)
df.index = pd.to_datetime(df.index)
# our guessed parameters
alpha = 0.4
beta = 0.2
gamma = 0.01
# initialise model
ets_model = ExponentialSmoothing(df_data, trend='add', seasonal='add',
seasonal_periods=12)
ets_fit = ets_model.fit(smoothing_level=alpha, smoothing_slope=beta,
smoothing_seasonal=gamma)
# forecast p hours ahead
p_ahead = 12
yh = ets_fit.forecast(p_ahead)