Exercise

Transfer learning

You saw that when training an embedding layer, you need to learn a lot of parameters.

In this exercise, you will see that when using transfer learning it is possible to use the pre-trained weights and don't update them, meaning that all the parameters of the embedding layer will be fixed, and the model will only need to learn the parameters from the other layers.

The function load_glove is already loaded on the environment and retrieves the glove matrix as a numpy.ndarray vector. It uses the function covered on the lesson's slides to retrieve the glove vectors with 200 embedding dimensions for the vocabulary present in this exercise.

Instructions

100 XP
  • Use the pre-defined function to load the glove vectors.
  • Use the initializer Constant on the pre-trained vectors.
  • Add the output layer as a Dense with one unit.
  • Print the summary and check the trainable parameters.