我正在训练一个LSTM模型,使用50个步骤的顺序输入3种不同功能,如下所示:
#x_train
[[[a0,b0,c0],.....[a49,b49,c49]],
[a1,b1,c1]......[a50,b50,c50]],
...
[a49,b49,c49]...[a99,b99,c99]]]
Run Code Online (Sandbox Code Playgroud)
使用以下因变量
#y_train
[a50, a51, a52, ... a99]
Run Code Online (Sandbox Code Playgroud)
下面的代码只能预测a,如何在给定的时间步长预测并返回[a,b,c]向量?
def build_model():
model = Sequential()
model.add(LSTM(
input_shape=(50,3),
return_sequences=True, units=50))
model.add(Dropout(0.2))
model.add(LSTM(
250,
return_sequences=False))
model.add(Dropout(0.2))
model.add(Dense(1))
model.add(Activation("linear"))
model.compile(loss="mse", optimizer="rmsprop")
return model
Run Code Online (Sandbox Code Playgroud)