5-Days Lead forecasting with LSTM
2 views (last 30 days)
Show older comments
Hello, I have worked on a problem and used LSTM explained following.
To be clear with my question let me explain the problem I am working on. I have 200 water level timeseries data of river. And I have successfully run the LTSM code which can predict one step ahead forecasting (i.e. as per my knowledge when testing, if I give todays water level data it will predict the next days value).
But I want to it to predict 5 step ahead (i.e. when testing, if I give todays water level data it will predict the value for 5th day)
0 Comments
Answers (1)
Anay
on 3 Apr 2025
Hi Foysol,
I understand that you want to train a LSTM model to predict output 5 steps ahead. The example you are currently referring to shows how to train an LSTM model to predict a single element ahead in the sequence.
You can predict next 5 outputs by utilizing the “Closed loop forecasting” method where in order to predict output for time steps t to t + k, you need to have true value for the time step t - 1 only. Then, to make prediction for step i, use the predicted value for time step i – 1 as input.
numPredictionTimeSteps = 5; %Predict for next 5 time steps
Y = zeros(numPredictionTimeSteps,numChannels);
Y(1,:) = Z(end,:);
for t = 2:numPredictionTimeSteps
[Y(t,:),state] = predict(net,Y(t-1,:));
net.State = state;
end
You can refer to the “Closed loop forecasting” section of the “Sequence Forecasting Using Deep Learning Example” by following the below link:
I hope this resolves the issue!
0 Comments
See Also
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!