W4_Ex-4_Tests failing

Glad to know that Venkatesh!

Rise and Shine!

I had the same issue, which seems to be related to the random seed set in initialize_parameters_deep() compared to the random seed set in initialize_parameters() function. The first part of the exercise is expecting the np.random.seed(1) used in the initialize_parameters function. In theory either initialize parameters function should work.

2 Likes

Hello Nudell,

Welcome to the community.

I think you are talking about copy and copy.deepcopy thing inside the function.

The initialize_parameters_deep() is used to get the same set values for all the defined variables that have been used in practice from the beginning.

To answer the below query, this can’t be true in every case.

In theory either initialize parameters function should work.

Also, you would like to check more on this. Look out for this link and this.

I am getting same error, how did you solve it?

Hello Rishi Dikshit,

Welcome to the community!

If you would have gone through the suggestions earlier in the thread, it clearly states that you are using hard-coded values within the function, causing such errors. Trouble shoot the default values in the codes to get the desired output.

Only you provided the correct solution.

To make it clearer, in the " Programming Assignment: Building your Deep Neural Network: Step by Step", we implemented 2 parameter initializers: def initialize_parameters(n_x, n_h, n_y) and def initialize_parameters_deep(layer_dims)

By design of this course, the 1st one should be used in the Ex-1 two-layer Neural Network and the 2nd one should be used in the Ex-2 L-layer Neural Network, in which way you could clear this issue in your notebook.

1 Like

Right! It’s actually more than just the random seeds: the two functions actually use different algorithms at least here in W4 A2. They had to use a more sophisticated algorithm for the L layer case to get decent convergence. If you copied over your “deep” init from the Step by Step exercise, you would also fail the tests here.

my test failed same as yours, the suggestion from here is hard code issue, which is not helping me to solve any problems. no support, but stuck in the same place days after days. I would like to cancel my subscription as you went to a school just you, no teacher

There is support available by asking questions here on the forum. Have you read the other posts on this thread?

Is your failure on the two layer model or the L layer model? If it fails on the 2 layer model, but careful that you did not call the “deep” init routine. That works differently than the one for the two layer case.

If you fail on the L layer model, make sure that you did not “hand import” your functions from the Step by Step exercise. They use a more sophisticated version of the init function for the deep case here.