Error while running code for coursera-deeplearning/02-dnn/week02/optimization.py

Week 2 of Deep learning specialization - Improving Deep Neural Networks: Hyperparameter Tuning, Regularization

I’m getting the following error while trying to run update_parameters_with_adam -

NameError: name ‘update_parameters_with_adam_test_case’ is not defined

Below id my entire code if that helps -

# GRADED FUNCTION: update_parameters_with_adam
def update_parameters_with_adam(parameters, grads, v, s, t, learning_rate = 0.01,
                                beta1 = 0.9, beta2 = 0.999,  epsilon = 1e-8):
    # mentor edit: code removed

Please do not share your code for a graded assignment. That is not allowed by the Code of Conduct.

You should share a screen capture image that shows any error messages.

Tip:
Every time you open a notebook, you must run all of the cells starting from the top of the page. that is where the assets are imported and the workspace is created.

Sorry about that. Though it will be helpful to see the error. I ran every cell again and this time I got a different error -

AssertionError: Wrong values. Check you formulas for parameters[‘W1’]
!

I was not able to find a file named “optimization.py” in Week 2 of this course.
Can you post more details on where this file was found?

I have pasted the title of the assignment -

image

image

There is no file named “optimization.py” in that assignment.

Why is that file name in your thread title?

I did not remember what the title was called so I just guessed some name with “optimization” in it. Is that causing confusion ?

Yes, I am confused.
If you changed the notebook file name, the grader will not be happy.

The test is telling you that there is an error in your code, which is causing the values of (at least) W1 to be incorrect. The Adam algorithm is pretty complicated, so there are lots of details that need to be correct. If you’ve already checked your code carefully against the math formulas, then here’s the most common pitfall on that function:

Please carefully check the “order of operations” on the computation involving \epsilon (epsilon). The key thing to note is that it is in the denominator but not under the square root, right? Check your parens carefully in that expression. The notebook editor is syntax aware, so you can click a paren and it will highlight the matching one.