我有一个数据库,每10分钟测量一次所产生的能量,并且我一直试图拟合LSTM keras模型以仅考虑最近一小时/ 6个周期的产量来预测下一个周期的产量。
原始数据库(+5000个样本):
data['Producer 1'].head()
Date_time
2016-10-01 00:00:00 1278
2016-10-01 00:10:00 1166
2016-10-01 00:20:00 732
2016-10-01 00:30:00 740
2016-10-01 00:40:00 1122
Name: Producer 1, dtype: int64
[将数据标准化并将其分为训练/测试集后,选择[x-6:x-1]作为输入,并在时间x将生产作为目标,我拟合了以下模型:
model.compile(optimizer=tf.keras.optimizers.Adam(learning_rate=0.01),
loss='mse', metrics =['mse', 'mae'])
model.summary()
Model: "LSTM"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
lstm_2 (LSTM) (None, 24) 2496
_________________________________________________________________
output (Dense) (None, 1) 25
=================================================================
Total params: 2,521
Trainable params: 2,521
Non-trainable params: 0
history = model.fit(training_features, training_labels, validation_split=0.2,
epochs=1000, batch_size=500, callbacks=[earlystop])
结果:
我已经尝试更改模型的窗口大小和参数(学习率,隐藏层中的神经元等),但是结果似乎总是相对于原始值有所延迟,我不明白为什么。
return_sequences
保持为真),并合并使用BiLSTM(tf.keras.layers.Bidirectional
)。您的模型没有学习。