W1 - Exercise 3

Hello, I have a Numpy question which I could not find from the Numpy documentation.

For W1 Exercise 3, I’m setting:

D1 = np.random.randn(A1.shape[0], A1.shape[1])

I also tried:

D1 = np.random.randn(len(A1), len(A1[0]))

but neither worked. Any idea ?

If you are talking about the dropout assignment, that is the wrong random function. I suggest you have another look at the instructions and the comments in the notebook.

Thanks Paul, I changed it to np.random.rand() and it worked. I got “All tests passed”. I turns out that there are two different random functions, randn() and rand(), I noted the difference but thought it was a typo ! :slight_smile:

Yes, that little “n” on the end there makes a big difference. For this particular application, we need the “Uniform” distribution, not the “Normal” distribution.