DLS Course 1, week 4, Deep NN Application, second exercise wrong

Hello, guys,

It’s me again.

Every time I submit this exercise, I got a 50/100 score.

This beacause my two_layer_model function has erros:

The values W1, b1, W2, and b2 are always wrong, apparently (as well as a 0 variable is always wrong?). Also, two tests are passed, but two tests failed.

The only warning I got is that that I musn’t use global variables.

Here’s my code

(Moderator edit: solution code removed)

As you can see, I do not use global variables (I think). And also, as far as I can see, I followed the instructions and used each function properly.

Can you see if there’s anything wrong please ?

Even the ‘Validate’ button does not work (it loops infinitely).

I would like to pass to course 2.

Best,

Luis

This was posted in the Course 4 forum area.
I have moved it to the Course 1 area, where that course’s mentors are more likely to find it.

Hi, @Luis_David_Alvarez_C. Your progression of the cost during gradient descent does not match mine. Have you changed the learning rate parameter amywhere? Perhaps as a global in the cell above the two_layer_model function or the keyword argument in the signature of the two_layer_model function? It should be learning_rate = .0075 in both places.

P.S. It is against the Coursera Honor Code to post your solution code in this, or any other public forum. Traceback only, please. Thanks.

Hello !

Thank you for your answer.

Nope, I have not modified the learning rate parameter. In both places it is learning_rate = .0075.

In the cell that follows the two_later_model function I’am getting

Cost after iteration 1: 0.6564026188409187
Cost after first iteration: 0.6950464961800915
Cost after iteration 1: 0.7239781229671559

none of these 3 match, and I guess the must match, right?

Also, from the very begining, the values for W1, b1, W2, b2 (and 0?) are wrong, but for the first iteration these are randomly generated, where b1 and b2 are both vectors of 0 (I printed them to check). So, it does not make any sense.

Does the problem comes from a global variable issue ? I do not know, I cannot share you my code and this might mean anything.

Other suggestions ?

Best,

Luis

Post deleted by author

Post deleted by moderator.

The good thing about this assignment is that it’s rather easy to debug. You have to call the appropriate functions in the right place using the correct function arguments. That and some straightforward retrievals and assignments from and to dictionaries. In fact, the function signatures with the functions in the proper order are given to you in the instructions. So it’s mostly a matter of putting the right parameters of the arguments in the right place. That’s where deep learning thinking comes in.