Week 2 - Emojify - Emoji_v3a

I was able to create a model Emojify_V2 that passes all unit tests.
In Section 2.5, that model can fit the training set with accuracy ~100%. However, the trained model only got 69% accuracy on the test set. According to the guideline, I should get 80%-90%. Did I make anything wrong?

Did you set embedding layer ‘trainable’ to ‘False’?
I found that without doing that will also pass the test but result in poor performance.

Thank you for your response. I set trainable=False already in the function pretrained_embedding_layer() . The total trainable params printed from model summary is also coherent with the guidelines. I tried with different batch sizes and number of epochs, but the best test accuracy I could get is only 73%.

Did you use softmax in the activation layer? I found that using other activations also pass the test and will result in poor performance. I don’t think the grader will catch all the errors so the best way is to check the code carefully step by step.

1 Like

I have the same issue. I set trainable = False in the earlier part of the code, and also used ‘softmax’ activation function. Like quoctin, I also tried different batch size and epochs, but the result were 75%. It appears that the model is overfitting to the training set, because I see accuracy of 1.0 near the end of the training. I tried to change the dropout, but the code test did not allow me to change that part.
I wonder if I am doing something wrong in the code somewhere, or this is the highest figure I could get given the restriction of the parameter setting in the jupyter notebook.

Do not change any of those parameters. They are already correct.

There is an error in your code.

1 Like