【发布时间】:2017-06-27 22:20:46
【问题描述】:
我有一个包含 600 个连续点 (x(t), y(t)) 的训练批次,其中 x(t) 是 25 维向量,y(t) 是我的目标 (1 dim)。我想训练一个 LSTM 来预测在给定一些额外的 x(t) [t> 600] 的情况下该系列将如何继续。我尝试了以下模型:
model = Sequential()
model.add(LSTM(128, input_shape = (600,25), batch_size = 1, activation= 'tanh', return_sequences = True))
model.add(Dense(1, activation='linear'))
model.compile(loss='mean_squared_error', optimizer='adam')
model.fit(trainX, trainY, epochs=20 ,verbose=2) prediction
prediction = model.predict(testX, batch_size = 1)
拟合效果很好,但我在预测步骤中不断收到以下错误:
Error when checking : expected lstm_46_input to have shape (1, 600, 25) but got array with shape (1, 10, 25)
我错过了什么?
这是我的形状:
trainX.shape = (1,600,25)
trainY.shape = (1,600,1)
testX.shape = (1,10,25)
【问题讨论】: