1. Learn
  2. /
  3. Courses
  4. /
  5. Recurrent Neural Networks (RNN) for Language Modeling in Python

Exercise

Embeddings improves performance

Does the embedding layer improves the accuracy of the model? Let's check it out in the same IMDB data.

The model was already trained with 10 epochs, as in the previous model with simpleRNN cell. In order to compare the models, a test set (X_test, y_test) is available in the environment, as well as the old model simpleRNN_model. The old model's accuracy is loaded in the variable acc_SimpleRNN.

All required modules and functions as loaded in the environment: Sequential() from keras.models, Embedding and Dense from keras.layers and SimpleRNN from keras.layers.

Instructions

100 XP
  • Add the embedding layer to the model.
  • Compute the model's accuracy and store on the variable acc_embeddings.
  • Print the accuracy of the old and new models.