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

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (0)

Categorie

Scopri di più su Sequence and Numeric Feature Data Workflows in Help Center e File Exchange

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by