I have a error in Keras and I can't find the solution. I have searched the whole internet and I have still no answer ^^ Here is my Code.
model = Sequential()
model.add(LSTM(32, return_sequences=True, input_shape=X.values.shape))
model.add(LSTM(32, return_sequences=True))
model.add(LSTM(32))
model.add(Dense(10, activation="softmax"))
model.compile(loss="categorical_crossentropy", optimizer="adam", metrics=['accuracy'])
The error is the second line. It says "ValueError: Error when checking input: expected lstm_1_input to have 3 dimensions, but got array with shape (393613, 50)" The Shape of my Dataframe X is correct. And when I try to train the model the Error pops up
model.fit(X.values, Y.values, batch_size=200, epochs=10, validation_split=0.05)
I hope someone could help me :-)
[EDIT] Btw. here is the model.summary()
Layer (type) Output Shape Param #
lstm_1 (LSTM) (None, 393613, 32) 10624
lstm_2 (LSTM) (None, 393613, 32) 8320
lstm_3 (LSTM) (None, 32) 8320
dense_1 (Dense) (None, 10) 330
Total params: 27,594 Trainable params: 27,594 Non-trainable params: 0
Kind regards Niklas.
X
. – Vikash SinghX_train = np.reshape(X_train, (X_train.shape[0], 1, X_train.shape[1]))
– Vikash Singh