0
$\begingroup$

I'm trying to solve binary classification problem with a Bidirectional LSTM.
The dataset used is the IMDB positive/negative neview.
That's my model:

model = keras.models.Sequential()
model.add(keras.layers.Embedding(input_dim=num_words, output_dim=10))
model.add(keras.layers.Bidirectional(keras.layers.LSTM(16, return_sequences=True)))
model.add(keras.layers.Bidirectional(keras.layers.LSTM(8)))
model.add(keras.layers.Dropout(0.2))
model.add(keras.layers.Dense(1, activation="sigmoid"))
model.compile(loss="binary_crossentropy", optimizer="adam", metrics=["accuracy"])

Here is the loss, with 10 epochs and batch_size = 128: enter image description here

What should I change in order to overcome this overfitting?
I tried to add some Dropout layers, adding Bidirectional layers, changing the unit value in the Bidirectional layer, but nothing worked.

$\endgroup$
1
  • $\begingroup$ Perhaps you should stop training sooner, before your generalization performance degrades. $\endgroup$ May 11 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.