我正在SemEval 2017 任务 4A 数据集上训练 LSTM 模型。我观察到第一次验证准确度随着训练准确度的增加而增加,但随后突然大幅下降。损失减少,但验证损失显着增加。
这是我的模型的代码
model = Sequential()
model.add(Embedding(max_words, 30, input_length=max_len))
model.add(BatchNormalization())
model.add(Activation('tanh'))
model.add(Dropout(0.3))
model.add(Bidirectional(LSTM(32)))
model.add(BatchNormalization())
model.add(Activation('tanh'))
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))
model.summary()
这是模型摘要
Model: "sequential_2"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
embedding_2 (Embedding) (None, 300, 30) 60000
_________________________________________________________________
batch_normalization_3 (Batch (None, 300, 30) 120
_________________________________________________________________
activation_3 (Activation) (None, 300, 30) 0
_________________________________________________________________
dropout_3 (Dropout) (None, 300, 30) 0
_________________________________________________________________
bidirectional_2 (Bidirection (None, 64) 16128
_________________________________________________________________
batch_normalization_4 (Batch (None, 64) 256
_________________________________________________________________
activation_4 (Activation) (None, 64) 0
_________________________________________________________________
dropout_4 (Dropout) (None, 64) 0
_________________________________________________________________
dense_2 (Dense) (None, 1) 65
=================================================================
Total params: 76,569
Trainable params: 76,381
Non-trainable params: 188
我正在使用 GloVe 进行词嵌入、Adam 优化器、二元交叉熵损失函数。