1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Deep Learning in Python

Connected

Exercise

Adding layers to a network

You've seen how to experiment with wider networks. In this exercise, you'll try a deeper network (more hidden layers).

Once again, you have a baseline model called model_1 as a starting point. It has 1 hidden layer, with 10 units. You can see a summary of that model's structure printed out. You will create a similar network with 3 hidden layers (still keeping 10 units in each layer).

This will again take a moment to fit both models, so you'll need to wait a few seconds to see the results after you run your code.

Instructions

100 XP
  • Specify a model called model_2 that is like model_1, but which has 3 hidden layers of 10 units instead of only 1 hidden layer.
    • Use input_shape to specify the input shape in the first hidden layer.
    • Use 'relu' activation for the 3 hidden layers and 'softmax' for the output layer, which should have 2 units.
  • Compile model_2 as you have done with previous models: Using 'adam' as the optimizer, 'categorical_crossentropy' for the loss, and metrics=['accuracy'].
  • Hit 'Submit Answer' to fit both the models and visualize which one gives better results!