keras模型的二元交叉熵精度没有改变

Binary Crossentropy accuracy of keras model is not changing

我在网上看到很多关于这个问题的问题,但没有明确的解决方案,我的情况可能有所不同,因为它是时间序列数据和 LSTM 架构。

model = Sequential()
model.add(LSTM(50, activation='relu', return_sequences=True, input_shape=(n_steps, n_features)))
model.add(LSTM(50, activation='relu'))
model.add(Dense(1, activation = 'sigmoid'))
model.compile(optimizer='adam', loss='binary_crossentropy',metrics=['accuracy'])

日志:

Train on 290 samples, validate on 190 samples
Epoch 1/4000
 - 1s - loss: 0.6896 - accuracy: 0.5586 - val_loss: 0.6846 - val_accuracy: 0.6105
Epoch 2/4000
 - 0s - loss: 0.6890 - accuracy: 0.5586 - val_loss: 0.6843 - val_accuracy: 0.6105
Epoch 3/4000
 - 0s - loss: 0.6889 - accuracy: 0.5586 - val_loss: 0.6829 - val_accuracy: 0.6105
Epoch 4/4000
 - 0s - loss: 0.6884 - accuracy: 0.5586 - val_loss: 0.6827 - val_accuracy: 0.6105
Epoch 5/4000
 - 0s - loss: 0.6883 - accuracy: 0.5586 - val_loss: 0.6825 - val_accuracy: 0.6105
Epoch 6/4000
 - 0s - loss: 0.6882 - accuracy: 0.5586 - val_loss: 0.6822 - val_accuracy: 0.6105
Epoch 7/4000
 - 0s - loss: 0.6882 - accuracy: 0.5586 - val_loss: 0.6820 - val_accuracy: 0.6105
Epoch 8/4000
 - 0s - loss: 0.6880 - accuracy: 0.5586 - val_loss: 0.6818 - val_accuracy: 0.6105
Epoch 9/4000
 - 0s - loss: 0.6880 - accuracy: 0.5586 - val_loss: 0.6806 - val_accuracy: 0.6105
Epoch 10/4000
 - 0s - loss: 0.6876 - accuracy: 0.5586 - val_loss: 0.6795 - val_accuracy: 0.6105

有几件事要尝试:

  • 降低学习率。
  • 数据集是否不平衡?如果是,那么模型已经学会了只预测一个 class(我认为这是原因)。
  • 尝试给不平衡的class更多的权重检查this
  • 尝试重置模型,tf.keras.backend.clear_session
  • 尝试集成,弱学习者。
  • 更好的是,尝试一个基本的时间序列回归模型,例如 ARMA 作为基线结果。