【发布时间】:2020-09-28 10:15:24
【问题描述】:
我有 3650 个时间步之前的数据,但我想做出未来的预测,即 3650 个时间步之后的数据。我是机器学习的新手,显然无法弄清楚。我该怎么做? 以供参考, Colab Notebook
【问题讨论】:
标签: tensorflow machine-learning time-series data-science prediction
我有 3650 个时间步之前的数据,但我想做出未来的预测,即 3650 个时间步之后的数据。我是机器学习的新手,显然无法弄清楚。我该怎么做? 以供参考, Colab Notebook
【问题讨论】:
标签: tensorflow machine-learning time-series data-science prediction
here 描述了如何使表格(或横截面)回归算法适应预测问题的一般方法。简而言之:你在滞后观察的窗口上训练你的模型。要生成预测,您有不同的选择,使用最常用的递归策略,在这里您使用最后一个可用窗口来预测第一个值,然后用第一个预测值更新最后一个窗口来预测下一个值,依此类推。
如果您有兴趣,我们正在为这些用例开发一个扩展 scikit-learn 的工具箱。所以使用sktime,你可以简单地写:
import numpy as np
from sktime.datasets import load_airline
from sktime.forecasting.compose import ReducedRegressionForecaster
from sklearn.svm import RandomForestRegressor
from sktime.forecasting.model_selection import temporal_train_test_split
from sktime.performance_metrics.forecasting import smape_loss
y = load_airline() # load 1-dimensional time series
y_train, y_test = temporal_train_test_split(y)
fh = np.arange(1, len(y_test) + 1) # forecasting horizon
regressor = RandomForestRegressor()
forecaster = ReducedRegressionForecaster(regressor, window_length=10)
forecaster.fit(y_train)
y_pred = forecaster.predict(fh)
print(smape_loss(y_test, y_pred))
>>> 0.139046791779424
【讨论】: