1. Learn
  2. /
  3. Courses
  4. /
  5. Recurrent Neural Networks (RNNs) for Language Modeling with Keras

Connected

Exercise

Keras models

In this exercise you'll practice using two classes from the keras.models module. You will create one model using the Sequential class and another model with the Model class.

The Sequential class is easier to use because the layers are assumed to be in order, while the Model class is more flexible and allows multiple inputs, multiple outputs and shared layers (shared weights).

The Model class needs to explicitly declare the input layer, while in the Sequential class, this is done with the input_shape parameter.

The objects and modules Sequential, Model, Dense, Input, LSTM and np (numpy) are already loaded on the environment.

Instructions 1/2

undefined XP
  • 1
    • Instantiate theSequential model with name sequential_model.
    • Add one LSTM layer and one Dense layer, and print the summary.
  • 2
    • Create an Input layer, add LSTM and Dense layers and store in main_output.
    • Instantiate the model and print its summary.