Tensorflow 使用窗口数据集预测未来时期的时间序列值
我有3650个时间步之前的数据,但我想做未来预测,即3650个时间步之后的数据。我是机器学习新手,显然搞不懂。我怎么做? 作为参考,Tensorflow 使用窗口数据集预测未来时期的时间序列值,tensorflow,machine-learning,time-series,data-science,prediction,Tensorflow,Machine Learning,Time Series,Data Science,Prediction,我有3650个时间步之前的数据,但我想做未来预测,即3650个时间步之后的数据。我是机器学习新手,显然搞不懂。我怎么做? 作为参考, 描述了如何使表格(或横截面)回归算法适应预测问题的一般方法。简言之:在滞后观测窗口上训练模型。要生成预测,您有不同的选项,最常用的是递归策略,这里您使用最后一个可用窗口预测第一个值,然后使用第一个预测值更新最后一个窗口以预测下一个值,依此类推 如果您感兴趣,我们正在开发一个工具箱,它扩展了scikit learn,正好用于这些用例。因此,你可以简单地写下: imp
描述了如何使表格(或横截面)回归算法适应预测问题的一般方法。简言之:在滞后观测窗口上训练模型。要生成预测,您有不同的选项,最常用的是递归策略,这里您使用最后一个可用窗口预测第一个值,然后使用第一个预测值更新最后一个窗口以预测下一个值,依此类推 如果您感兴趣,我们正在开发一个工具箱,它扩展了scikit learn,正好用于这些用例。因此,你可以简单地写下:
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