1

I come to ask a question concerning the future predictions with an LSTM models

I explain to you :

I am using an LSTM model to predict the stock price for the next 36 hours.

I have a dataset with 10 features.

I use these 10 features as inputs in my model with a single output (the expected price).

Here is my overall model:

model = Sequential()
 
# input shape == (336, 10), I use 336 hours for my lookback and 10 features

model.add(LSTM(units=50,return_sequences=True,input_shape=(X_train.shape[1], X_train.shape[2])))
  model.add(Dropout(0.2))
  model.add(LSTM(units=50,return_sequences=True))
  model.add(Dropout(0.2))
  model.add(LSTM(units=50,return_sequences=True))
  model.add(Dropout(0.2))
  model.add(LSTM(units=50))
  model.add(Dropout(0.2))
  model.add(Dense(units=1, activation='linear'))
  model.compile(optimizer='adam',loss='mean_squared_error')

I can assess the performance of my model with my test data, but now I would like to use it to predict the next 36 hours, that's the goal anyway, isn't it?

And there I have the impression that there is a big black hole on the internet, everyone presents how to build models and test them with the test data but nobody uses them...

I found two interesting examples which consist in re-integrating the prediction into the last window iteratively.

Here are the examples at the bottom of the topics:

https://towardsdatascience.com/time-series-forecasting-with-recurrent-neural-networks-74674e289816 https://towardsdatascience.com/using-lstms-to-forecast-time-series-4ab688386b1f

In itself it works but with only one feature as input.

I have 10 features, my model just returns me an output value so I cannot reintegrate it into the last window which expects 10 features in its shape.

Do you see the problem?

I really hope you can orient me on the subject.

Adrien

aborderon
  • 21
  • 3
  • 1
    Does this answer your question? [Predicting a multiple forward time step of a time series using LSTM](https://stackoverflow.com/questions/47594861/predicting-a-multiple-forward-time-step-of-a-time-series-using-lstm) – N. Kiefer Sep 24 '20 at 11:50
  • Thank you for your reply. However, the example is not really clear and I find it complex to define another model to predict the future. Aren't there some simple examples for using a multivariate LSTM model to predict the future? It's still astonishing, don't you think? Many subjects to present the LSTMs with the evaluation on the test data but none of them to actually use them ... Because in itself the model is useless if it is not used ^^ I understood that it was necessary to re-integrate the predicted data into the windows but I cannot find a concrete example on the subject. – aborderon Sep 24 '20 at 13:36
  • Will this answer your question https://www.tensorflow.org/tutorials/structured_data/time_series. Write custom callback to predict input data for 36 hours. Thanks! – TFer Feb 01 '21 at 02:36

0 Answers0