我想计算 KATS 的 Prophet 、 SARIMA 和 Ensemble 模型的 RMSE 和 MSE
我进行了一项分析,通过将数据框转换为时间序列数据来预测它。我想计算 KATS 的 Prophet、SARIMA 和 Ensemble 模型的 RMSE 和 MSE。
对于萨里玛 代码:
from kats.models.sarima import SARIMAModel, SARIMAParams
warnings.simplefilter(action='ignore')
# create SARIMA param class
params = SARIMAParams(p=2 ,
d=1,
q=1,
trend = 'ct',
seasonal_order=(1,0,1,12)
)
# initiate SARIMA model
m = SARIMAModel(data=ts, params=params)
# fit SARIMA model
m.fit()
# generate forecast values
fcst = m.predict(
steps=HOURS ,
include_history = True
)
# make plot to visualize
plt1 = m.plot()
plt.xlabel('Time (in days)')
plt.ylabel('Noise Level (db)')
预测结果: SARIMA 预测
For Prophet
代码:
from kats.models.prophet import ProphetModel, ProphetParams
# create a model param instance
params = ProphetParams(seasonality_mode='multiplicative') # additive mode gives worse results
# create a prophet model instance
m = ProphetModel(ts, params)
# fit model simply by calling m.fit()
m.fit()
# make prediction for next HOURS hours
fcst = m.predict(steps=HOURS, include_history = True)
# plot to visualize
plt2 = m.plot()
plt.xlabel('Time (in days)')
plt.ylabel('Noise Level (db)')
预测结果:
谁能告诉我如何实现它?我尝试了几种汇总统计技术,但似乎不起作用。谢谢!
I have conducted an analysis where I have forecasted my data frame by converting it into timeseries data. I would like to calculate RMSE and MSE for Prophet, SARIMA and Ensemble models from KATS.
For SARIMA
Code:
from kats.models.sarima import SARIMAModel, SARIMAParams
warnings.simplefilter(action='ignore')
# create SARIMA param class
params = SARIMAParams(p=2 ,
d=1,
q=1,
trend = 'ct',
seasonal_order=(1,0,1,12)
)
# initiate SARIMA model
m = SARIMAModel(data=ts, params=params)
# fit SARIMA model
m.fit()
# generate forecast values
fcst = m.predict(
steps=HOURS ,
include_history = True
)
# make plot to visualize
plt1 = m.plot()
plt.xlabel('Time (in days)')
plt.ylabel('Noise Level (db)')
Forecasted result:
SARIMA Forecasting
For Prophet
Code:
from kats.models.prophet import ProphetModel, ProphetParams
# create a model param instance
params = ProphetParams(seasonality_mode='multiplicative') # additive mode gives worse results
# create a prophet model instance
m = ProphetModel(ts, params)
# fit model simply by calling m.fit()
m.fit()
# make prediction for next HOURS hours
fcst = m.predict(steps=HOURS, include_history = True)
# plot to visualize
plt2 = m.plot()
plt.xlabel('Time (in days)')
plt.ylabel('Noise Level (db)')
Forecasted result:
Can anyone please tell me how can I achieve it? I have tried several summary statistic techniques but it doesn't seem to work. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Kats 201 教程笔记本 在第 4 节和第 5 节中提供了示例展示如何使用 Kats 计算
evaluation_function
(此处为 MAE)并执行回溯测试来计算许多错误指标(MAPE、 SMAPE、MAE、MASE、MSE、RMSE)。The Kats 201 tutorial notebook has examples in sections 4 and 5 showing how to use Kats to compute an
evaluation_function
(here, MAE) and to perform backtesting to compute many error metrics (MAPE, SMAPE, MAE, MASE, MSE, RMSE).