Week 4 - Deep Neural Network - Application Code

How do you interpret the next python code:

layers_dims = [12288, 20, 7, 5, 1] # 4-layer model

Initially, we had (n_x, n_h, n_y). I think n_x = 12288, n_h = 5, and n_y = 1. What mean 20 and 7?

Thanks!

1 Like

The triplet (n_x, n_h, n_y) defined the layer dimensions for the model with a single hidden layer. So we had the input layer, a hidden layer, and the output layer. With the 4-layer model, there are three hidden layers. In the notebook, they are defined globally in the cell to which you refer. The layer_dims list will be invoked in the ensuing L_layer_model function, to help initialize the parameters. In short, you have moved from a “shallow” network to a deeper one. Let the fun begin!