I was trying to train a LSTM model using keras but I think I got something wrong here.
I got an error of
ValueError: Error when checking input: expected lstm_17_input to have
3 dimensions, but got array with shape (10000, 0, 20)
while my code looks like
model = Sequential()
model.add(LSTM(256, activation="relu", dropout=0.25, recurrent_dropout=0.25, input_shape=(None, 20, 64)))
model.add(Dense(1, activation="sigmoid"))
model.compile(loss='binary_crossentropy',
optimizer='adam',
metrics=['accuracy'])
model.fit(X_train, y_train,
batch_size=batch_size,
epochs=10)
where X_train
has a shape of (10000, 20)
and the first few data points are like
array([[ 0, 0, 0, ..., 40, 40, 9],
[ 0, 0, 0, ..., 33, 20, 51],
[ 0, 0, 0, ..., 54, 54, 50],
...
and y_train
has a shape of (10000, )
, which is a binary (0/1) label array.
Could someone point out where I was wrong here?
See Question&Answers more detail:
os