我如何预测下一个连续值?

时间:2019-05-04 22:31:17

标签: python keras lstm

model = Sequential()
model.add(LSTM(256, input_shape=(None, 1),return_sequences=True))
model.add(Dropout(0.3))

model.add(LSTM(256, input_shape=(None, 1)))
model.add(Dropout(0.3))


model.add(Dense(1))
model.compile(loss='mean_squared_error', optimizer='adam', metrics=['accuracy'])


model.summary()
model.fit(x_train, y_train, epochs=10, batch_size=32, verbose=2, validation_data=(x_val, y_val))

这是我的模特

如果我想预测第二天

LastValue = dataset[-1]
LastValue = np.reshape(LastValue, (1,1,1))

next_one = model.predict(LastValue)

是对的吗?如果正确的话,

我如何预测接下来的1000天?

next_two = model.predict(next_one)
next_three = model.predict(next_two)
next_four = model.predict(next_three)
...
I want to get a thousand list.

我该如何实现?

0 个答案:

没有答案