我有一个2D数组(pandas),它是3180行的时间序列,每行有8列(数组)作为特征。我正在尝试训练LSTM层
sc = StandardScaler()
X_train = sc.fit_transform(X_train)
print (X_train.shape)
classifier = Sequential()
classifier.add(LSTM(units=128, input_shape=(1, len(X_train), x.shape[1])))
如this中所述。但错误就像,
ValueError: Input 0 is incompatible with layer lstm_1: expected ndim=3, found ndim=4
答案 0 :(得分:0)
LSTM
期望3D数组作为输入,因此input_shape
形状的长度应为2 ...
假设X_train.shape
为(3180, 8, 1)
,这应该有效:
LSTM(units=128, input_shape=X_train.shape[1:]))