我想计算 KATS 的 Prophet 、 SARIMA 和 Ensemble 模型的 RMSE 和 MSE

发布于 2025-01-12 21:36:27 字数 1465 浏览 0 评论 0原文

我进行了一项分析,通过将数据框转换为时间序列数据来预测它。我想计算 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:

Prophet Forecasting

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ι不睡觉的鱼゛ 2025-01-19 21:36:27

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文