Course 2 week 1 Regularization assignment

Hi guys , please can anyone of you help me, here in dropout forward propagation I get tests failed and I don’t understand why .

Thanks in advance <3

{moderator edit - solution code removed}

1 Like

You are using the wrong random function there. We want random values distributed evenly between 0 and 1, but that is not what you get from np.random.randn. That is the Gaussian Distribution with \mu = 0 and \sigma = 1, right?

Please have a more careful look at the instructions.

4 Likes

I am using np.random.rand but get the same error one test pass , one test failed, I can’t figure out why

Please show us the actual values that you get on the failing test, as the original post on this thread does. Notice that when you get one test passed, it is usually checking the shape and type of the outputs first, so that just means your output is an array of the correct shape. Then it tests the actual values and that fails.

Other things to check are that your dropout mask is randomly generated with the same shape as the A value for each layer where dropout is applied, not a column vector. Also make sure that you did all the code the same way in both layers and remembered the “reverse scaling” of the output values.