Session Ready
Exercise

Keras models

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

The Sequential class is easier since 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 a LSTM and a Dense layers, 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.