现在在训练完模特之后
model.output_shape
输出为:
(无,1)
据我所知,它将为测试集提供一步预测。但我希望它是30行预测,每个未来步骤一行,测试集中的每一行(就像我的例子中的输出应该是(1025643,30,1))。我需要对数据形状做哪些更改?我正在使用keras lstm和tensorflow后端以及python 3.6。
model = Sequential()
model.add(LSTM(100, return_sequences=True, input_shape = (trainX.shape[1], trainX.shape[2])))
model.add(LSTM(100, return_sequences = False))
model.add(Dense(1, activation='linear'))
model.compile(loss='mse', optimizer='adam')
model.fit(trainX, trainY, epochs=50, shuffle=False, verbose=1)