Predicting future values in LSTM for time series

I've been following this tutorial -
And implemented it succesfully too, I wanted to know if i can predict future values (beyond the last date in my time series data), if yes, then how to do it?
Like I have time series data for 90 days, so if i use this model, then It will divide the data into training and testing and then we can get a forecast for testing data but say if i want to find out the prediction for 100th day, how to do it?

5 comentarios

Lynn Tung
Lynn Tung el 28 de Abr. de 2020
Hello, did you find the answer to the question above? I'm also very interested in knowing how to predict the future values using LSTM method.
Thanks,
dear Aman,
i hope you are fine.
well, you have done this prediction once and it is not really complicated!
as you predict data for your current samples, you can easily predict future samples.
just consider delay(s) for your data and then the minimum delay will explain your prediction horizon.
for instance, if your sequence samples (time series data) is,
1.1 2.8 3.9 1.3 4.5 5.3 6.0 9.1
delay one will be formed your input/target data like below,
Input = 1.1 2.8 3.9 1.3 4.5 5.3 6.0
Target = 2.8 3.9 1.3 4.5 5.3 6.0 9.1
so by giving 1.1 to the network, we anticipate network predict 2.8( which is the next value)
and finally, by giving 9.1 to the network, we anticipate network predict the next future sample(what excatly you want)
Thank you for your reply @Abolfazl, I could understand what your trying to explain, but honestly, I'm quite new in these this so it was difficult to exactly understand the code and how to change it for future values.
But after taking a close look at the workspace in matlab and understanding the erros, somehow i ended up changing these lines of code and I was able to forecast future values
dataTrain = data(1:numTimeStepsTrain+1);
dataTest = data(numTimeStepsTrain+1:end);
YTest = dataTest(2:end);
idx = numTimeStepsTrain:(numTimeStepsTrain+numTimeStepsTest);
My change -
train=data(1:num_steps_train);
test=data(num_steps_train-4:end); %for future 5 days, for 10 days -> num_steps_train-9 and so on...
YTest=test(1:end);
idx=num_steps_train:(num_steps_train+num_steps_test+1);
I hope this helps you as well Lynn
ZAHIR HOSSAIN
ZAHIR HOSSAIN el 5 de Ag. de 2020
Editada: ZAHIR HOSSAIN el 6 de Ag. de 2020
can you upload the full code please, i am having some trouble with rmse calculation, changing ytest gives error "Matrix dimensions must agree." the full code can give me a better understanding for my case. Aman Swaraj
yosra didi
yosra didi el 12 de Ag. de 2020
Could you upload the full code, i am facing a problem, thanks

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Preguntada:

el 20 de Abr. de 2020

Comentada:

el 12 de Ag. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by