【发布时间】:2021-01-23 13:23:14
【问题描述】:
前言:我不知道自己在做什么。
对于一个 uni stats 类,我们必须在 python 中进行一些时间序列预测。
我基本上遵循了本教程,但使用了我的数据:https://www.digitalocean.com/community/tutorials/a-guide-to-time-series-forecasting-with-arima-in-python-3
除了 MSE,一切都运行良好。
绘制所有内容时,它看起来像这样:
这是我用于 MSE 的数据:
原始数据(交易['2016-05-01':]):
DATE_BOOKING
2016-05-01 11327.548387
2016-06-01 11534.000000
2016-07-01 11391.677419
2016-08-01 11259.451613
2016-09-01 11968.366667
2016-10-01 7844.387097
2016-11-01 6270.800000
2016-12-01 5103.516129
2017-01-01 4631.032258
2017-02-01 5092.928571
2017-03-01 7800.258065
2017-04-01 8359.133333
2017-05-01 9495.062500
预测(预测)数据(pred.predicted_mean):
DATE_BOOKING
2016-05-01 9375.120610
2016-06-01 11038.420268
2016-07-01 11571.006853
2016-08-01 10856.183244
2016-09-01 10148.262512
2016-10-01 9433.060067
2016-11-01 7044.780142
2016-12-01 5037.930509
2017-01-01 5337.963486
2017-02-01 5767.081120
2017-03-01 6616.610224
2017-04-01 9389.836132
2017-05-01 10258.791544
我按以下方式计算 MSE:
transactions_forecasted = pred.predicted_mean
transactions_truth = transactions['2016-05-01':]
mse = ((transactions_forecasted - transactions_truth) ** 2).mean()
print('The Mean Squared Error of our forecasts is {}'.format(round(mse, 2)))
print('The Root Mean Squared Error of our forecasts is {}'.format(round(np.sqrt(mse), 2)))
这是结果:
我们预测的均方误差为 1130250.12
我们预测的均方根误差为 1063.13
与我用谷歌搜索的其他 MSE 相比,它似乎非常高。
你能告诉我我做错了什么吗?
如果需要,我可以发布更多(全部)代码。
提前致谢!
【问题讨论】:
标签: python statsmodels arima mse