Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Tensorflow 使用窗口数据集预测未来时期的时间序列值_Tensorflow_Machine Learning_Time Series_Data Science_Prediction - Fatal编程技术网

Tensorflow 使用窗口数据集预测未来时期的时间序列值

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

我有3650个时间步之前的数据,但我想做未来预测,即3650个时间步之后的数据。我是机器学习新手,显然搞不懂。我怎么做? 作为参考,
描述了如何使表格(或横截面)回归算法适应预测问题的一般方法。简言之:在滞后观测窗口上训练模型。要生成预测,您有不同的选项,最常用的是递归策略,这里您使用最后一个可用窗口预测第一个值,然后使用第一个预测值更新最后一个窗口以预测下一个值,依此类推

如果您感兴趣,我们正在开发一个工具箱,它扩展了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