0

NOTE: all the numbers below are indicative only.

I trained my LSTM model with the following parameters:

batch_size = 32
time_step = 5

I know I need at least 5 samples to feed my model.predict() in order to predict the next outcome into the future. For example let's say I have the following items in a CSV file:

enter image description here

Since time_step equals to 5, I convert the data into an array with the sahpe of 1 x 5 x 4. Let's call this array X_input. Now:

model.predict(X_input)

is supposed to return only 1 item. Let's say this value is 58 which is the right answer. If the CSV file contains, for example, 6 items:

enter image description here

X_input should have the shape of 2 x 5 x 4 and model.predict() returns two values which are supposed to be [57, 58].

In fact, if the last 5 samples in my CSV file are the same, I expect the last predicted value remains the same (i.e. 58), but it does NOT! It changes as the number of samples in my CSV file change despite the fact that I keep the last 5 samples in the CSV file unchanged.

At first I thought it might have something to do with the parameter stateful in my LSTM layers. But since I've not used that parameter, I assume it has the default value which is Flase.

Any idea please?

Joseph_Marzbani
  • 1,796
  • 4
  • 22
  • 36
  • 1
    You have a good description. Perhaps share the code for a minimal but complete example, including example data. That would make it easier to reproduce it or spot things you may not have mentioned. – de1 Jan 07 '21 at 23:38
  • Based on the description I would expect your model predicting 4 figures not one (one figure for every feature) – Andrey Jan 08 '21 at 08:01

0 Answers0