使用RNN的Weatherhistory.csv ValueError:连续图层15的输入0与该图层不兼容:预期ndim = 3,找到的ndim = 2。收到的完整图形:[1000、8] 什么需要进行更改??
'
print(X_train.shape)
print(X_test.shape)
print(y_train.shape)
print(y_test.shape)
Output:
(60000, 8)
(20000, 8)
(60000,)
(20000,)
rnn_model = Sequential()
rnn_model.add(SimpleRNN(40,activation="tanh",return_sequences=True, input_shape=X_train.shape))
rnn_model.add(Dropout(0.15))
rnn_model.add(SimpleRNN(40,activation="tanh",return_sequences=True))
rnn_model.add(Dropout(0.15))
rnn_model.add(SimpleRNN(40,activation="tanh",return_sequences=False))
rnn_model.add(Dropout(0.15))
rnn_model.add(Dense(1))
rnn_model.summary()
#model compile
rnn_model.compile(optimizer="adam",loss="MSE")
#model fit
model1 = rnn_model.fit(X_train, y_train, epochs=10, batch_size=1000)'