Dears,

for me, the code in assignment 1 of week 1 seems not to work. I successfully implemented the zero initialization. I then tried to implement the random initialization the same way and get as the result 2 out of 3 tests passed, 1 test failed.

I printed out the dimensions of W and b and they match what I did before. I also multiplied the initialization of W by 10 and still used zero for b. Would highly appreciate if anyone has an idea what could be wrong

I posted the output below, can also post my code if helpful (not sure if I should paste it as per Honoer code)

Hey @Magnus_Josef_Maichle,

Welcome to the community. As the assertion error suggests, perhaps you have used a global variable in your implementation of `initialize_parameters_random`

. Can you please ensure that this is not the issue? And if this is not, then can you please DM your notebook as an attachment to me. You can find the instructions on how to download the notebook here.

Cheers,

Elemento

1 Like

Hey @Magnus_Josef_Maichle,

The error literally couldn’t be more smaller. It turns out all you are missing out is one “n” In your `initialize_parameters_random`

function, you have used `np.random.rand()`

to initialize `W`

, whereas, you are supposed to use `np.random.randn()`

. Since NumPy offers both these functions with different functionalities, hence the error. numpy.random.rand returns an array filled with random samples from a **uniform distribution over [0, 1)**, whereas, numpy.random.randn returns an array filled with random samples from **a univariate “normal” (Gaussian) distribution of mean 0 and variance 1**. Well, now you know how much important the alphabet “n” is

Cheers,

Elemento

Awesome works now!

Thanks for pointing it out, thought I was going crazy ;))))

Have a great day!

1 Like