W4 Programming 2 IndexError

Hello Sir,

I am having error in week 4 prograaming assignment.

Kindly help.

you need to set dz = 0 and not dz <=0

1 Like


It is default code, I can not change it.

When I said set dz=0, I meant check your cache in the backward propagation code.

While the boolean index of index array is not matching with forward propagation

if you want more clear hint then

There is error in linear activation backward, are you applying the correct codes as per the parameters, your activation is not matching with the hidden neural network unit in backward propagation.

1 Like

I think you should go over how you implemented the two_layer_model function again.
Make sure you actually use the provided helper functions eg initialize_parameters and the other three functions in the right way while supplying the right arguments.

1 Like

Check that you are passing the correct cache when you call linear_activation_backward function in two_layer_model function.

1 Like

I didn’t wanted to give him direct hint, so he tries to find himself the issue :slight_smile:

1 Like

I used your indirect hint only, ma’am. :sweat_smile:

I was passing cache1 in backward propagation in output layer and cache2 in hidden layer.
The error was because of this silly mistake.

Thanks to you and others for reaching out so promptly. :pray:

1 Like

Glab that you could find the issue yourself, that’s good sign of learning!!!

Happy Learning!!!