DLS C1 W4 Programming Assignment 1 Exercise 2 test case issue?

Hi, I’m having trouble with exercise 2 of the programming assignment 1 of Course 1, week 4 of DLS.

The problem is with the initialization of parameters for a deep neural network. The code I’ve written (2 lines) initializes the parameters, but they differ from the ones expected in the tests.

I think my parameters have the right dimensions, (they pass the assertion at the end of the function), but they just have different values from the ones expected in the test cases, which I’ve inspected.

I see that the random package is seeded in the beginning of the def initialize_parameters_deep(layer_dims) function with a 3. I don’t know if the expected values in the test cases were seeded with a different number? They’re hard coded in the tests so I don’t know.

Or maybe I’m just doing something wrong, but I think my code is right, based on the assertion, and the hints provided in the instruction as ‘inspiration’. For instance, I haven’t forgotten to scale the parameters.

Any help would be appreciated so I can successfully submit the assignment!

Cheers!

I did not have any trouble passing the test cases here, so the operating theory must be that something is wrong with your code. Please show us the output you get when you run the test that fails.

The most common error here is to use the wrong random function. Note that “rand” and “randn” differ by only one character, but the results are very different. :nerd_face:

1 Like

Thank you! Yep… it seems I was making that most common error. Works now.

2 Likes