Tensorflow Keras LSTM用于时间序列不良预测和收敛到不变值范围
模型:Tensorflow Keras LSTM用于时间序列不良预测和收敛到不变值范围,tensorflow,time-series,keras,forecasting,lstm,Tensorflow,Time Series,Keras,Forecasting,Lstm,模型: def buildModel(neurons= 5, batch_size= 1, timestep=1, features=1): model = Sequential() model.add(LSTM(neurons, batch_input_shape=(batch_size, timestep, features), #return_sequences= True,
def buildModel(neurons= 5, batch_size= 1, timestep=1, features=1):
model = Sequential()
model.add(LSTM(neurons,
batch_input_shape=(batch_size, timestep, features),
#return_sequences= True,
stateful=True))
model.add(Dense(1))
model.compile(loss='mean_squared_error', optimizer='adam',
metrics=[metrics.MAPE, 'accuracy'])
return model
测试RMSE:0.104
测试图:14.040
但当逐步进行多步预测时,预测结果迅速增加,然后稳定在一定范围内
时间序列是单变量的
任何与模型或时间序列预测问题相关的建议?神经元=5,这是一个容量非常低的模型。可能不足以对目标时间序列函数建模
timesteps=1,这是时间序列,因此在做出正确预测之前,输出必须依赖于一定数量的timesteps。timesteps=1表示您的输出仅依赖于1个timestep
batch_size=1,这需要一段时间才能收敛。通常,这应该是2 16、32、64、128、256、512的幂。感谢rowel提供的提示。我刚进入这个领域,需要一些帮助