我正在做时间序列预测,以预测未来的订单。因为数据是非平稳的,所以我做了记录和第一次差分。然后,我通过传递对数差分数据,使用从auto_arima获得的顺序值训练Arima模型。我用过去的30天进行测试,休息进行训练。我正在以记录格式和差分格式获取预测值。此外,我还预测了未来30天,这是没有出现在数据集中,给出了相同格式的预测。由于我没有未来30天的数据,如何在这两种情况下恢复原始数据。
发布于 2021-09-12 22:26:49
这可以使用numpy方便地完成。相反的操作涉及获取cumsum()
,然后获取exp()
。
可以执行以下操作: Algorithm reference courtesy @Divakar
series = df["Number of Bookings"]
new_series = np.log(series).diff()
# getting only the value of zeroth index since the diff() operation looses first value.
new_series.iloc[0] = np.log(series.iloc[0])
result = np.exp(new_series.cumsum())
https://stackoverflow.com/questions/69157727
复制相似问题