-
Notifications
You must be signed in to change notification settings - Fork 19.6k
Description
I want to predict sequences of number vectors based on the previous ones. I have five sequences. I considered the length of the history 100. I transformed the data to following format:
As an input X I have array of n matrices, each with 100 rows and 5 columns (technically, X is a tensor with dimensions n x 100 x 5). The target y will be matrix n x 5 - for each input X_i (matrix 100 x 5) I want one corresponding row of y (with just two elements).
So my input data (X) is a numpy array n x 100 x 5 and output (y) is n x 5 . My model is as follows:
in_out_neurons = 5
hidden_neurons = 20
model = Sequential()
model.add(LSTM(hidden_neurons, return_sequences=True, forget_bias_init = 'one', inner_activation='hard_sigmoid', input_shape=(100,5)))
model.add(Activation("sigmoid"))
model.add(Dropout(0.2))
model.add(LSTM(hidden_neurons, return_sequences=False, forget_bias_init = 'one', inner_activation='hard_sigmoid'))
model.add(Activation("sigmoid"))
model.add(Dropout(0.2))
model.add(Dense(in_out_neurons))
model.add(Activation("linear"))
model.compile(loss="mean_squared_error", optimizer="rmsprop")
model.fit(X_train, y_train, batch_size=450, nb_epoch=20, validation_split=0.05)
predicted = model.predict(X_test)
The problem is that it always predicts a constant value for each sequence for all times. But when I use the input of the following link with two sequences, it can predict very well:
I have changed number of epochs, batch_size but nothing changed! Can anybody help me find the problem?