如何设置LSTM输入层的输入形状,我的X_train有2列,y_train 1列

时间:2020-01-21 02:01:04

标签: python tensorflow keras lstm

from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
from keras.layers import Dropout

regressor = Sequential()

regressor.add(LSTM(units = 50, return_sequences= True, input_shape = (X_train.shape[0],2)))
regressor.add(Dropout(rate = 0.2))

regressor.add(LSTM(units = 50, return_sequences= True))
regressor.add(Dropout(rate = 0.2))

regressor.add(LSTM(units = 50))
regressor.add(Dropout(rate = 0.2))

regressor.add(Dense(units = 1))

regressor.compile(optimizer= 'adam', loss = 'mean_squared_error', metrics = ['accuracy'])

regressor.fit(X_train, y_train, batch_size = 1000, epochs = 25)'

我正在尝试根据y_train的两个功能来预测X_train的值

我最终收到错误消息:ValueError: Error when checking input: expected lstm_3_input to have 3 dimensions, but got array with shape (10000, 2)

0 个答案:

没有答案