Mutli step ahead prediction with LSTM (sequence to sequence regression)

1 次查看(过去 30 天)
I have three explanatory variables and one dependent variable. The data is time series data. I am performing sequence to sequence regression. The data is divided into training and test dataset. I have predicted one-step ahead prediction with LSTM but i want to predict 'k' steps ahead where k=2,4,6,8. I have a trained a 'net' for 1 step ahead prediction. For 'k' steps ahead prediction, i am following this code:
net = predictAndUpdateState(net,XTrain);
[net,YPred] = predictAndUpdateState(net,YTrain(end));
I get the error 'The prediction sequences are of feature dimension 1 but the input layer expects sequences of feature dimension 3'.
As in my case XTrain is 3*n matrix while YTrain is 1*n matrix
numTimeStepsTest = numel(XTest);
for i = 2:numTimeStepsTest
[net,YPred(:,i)] = predictAndUpdateState(net,YPred(:,i-1),'ExecutionEnvironment','cpu');
end
How to proceed ahead. Please help in predicting 'k' steps ahead. Thanks in advance.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

产品


版本

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by