ValueError:输入0与lstm_1层不兼容:预期ndim = 3,找到的ndim = 2

时间:2018-08-29 08:07:17

标签: python machine-learning neural-network keras lstm

我尝试创建模型:

model = Sequential()
model.add(Dense(100, input_shape=X_train.shape))
model.add(LSTM(100))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])

但是当我尝试运行它时,model.fit(X_train, Y_train, epochs=1)会抛出

  

ValueError: Input 0 is incompatible with layer lstm_1: expected ndim=3, found ndim=2

full code

data file

data format

谢谢!

PS。我知道其他问题,但是他们没有帮助我。

0 个答案:

没有答案