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:
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:
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?