Is This Correctly Work On Predict Next Value In Keras?
Solution 1:
According to your code you are trying to predict next value using lstm. So here you have to reshape your input data correctly to reflect the time steps and features.
model.add(LSTM(512, return_sequences=True))
instead of this code you have to write :
model.add(LSTM(512, input_shape=(look_back,x)))
x = input features in your training data.
I guess this article will help to moderate your code and predict the future value:
This article will help you to understand more about how to predict future value:
Thank you
Solution 2:
There are multiple methods you can try. There is no one right way at the moment. You can train a seperate model for predicting t+1, t+2 ... t+n. One LSTM model predicts t+1 while another predicts t+n. That is called a DIRMO strategy.
Your strategy (recursive strategy) is particularly risky because the model can propagate the error through multiple time horizons.
You can find a good comparison of alternative strategies in this paper. https://www.sciencedirect.com/science/article/pii/S0957417412000528?via%3Dihub
Post a Comment for "Is This Correctly Work On Predict Next Value In Keras?"