Course 2 week 2 Optimization_methods AssertionError: Wrong value

Hi all,
i’m stuck here where the assert function kicks in :slight_smile: AssertionError: Wrong value

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

help me to move to the next task :pray:
please see this image


that was under ------> # GRADED FUNCTION: update_parameters_with_adam

Wondering if it Is about the initialization of W? :thinking:

1 Like

Hi Faris!
Hope you are doing well. I have checked it and run it in my notebook, it works fine (no issues with the test cases), please check your implementation properly, and make sure that you are implementing all the steps correctly.
Regards,
Nithin

First rule is: always trust the error. If error say “Check you formulas for parameters[‘W1’]”, go ahead and check it. Not only the initialization step but also the other steps which change the W, like update parameters, etc.

Best,
Saif.

I am facing the same error ! I did checked all steps but I can’t find the origine of the issue

1 Like

If you’ve passed all the above tests, send me your code of update_parameters_with_adam privately. Click my name and message.

The most common errors here have to do with “order of operations” on the part of the computation involving \epsilon, the small constant that has the purpose of avoiding divide by zero problems. Note that \epsilon is in the denominator, but is not under the square root.

1 Like

thank you I found the issue !
all tests are passed now
thanks

Agree with [paulinpaloalto], check location of epsilon, E

1 Like

I had the same issue. I had placed epsilon under the square root. Bad note taking by me during lecture!

1 Like

Hi all,

I am facing the same error " AssertionError: Wrong value" (already mentioned) under the update_parameters_with_adam function ! I did checked all the formulas and steps (I put ϵ out of the square root), but still can’t find the origine of the issue.


This is the code of the functin :

{moderator edit - solution code removed}

Can you please help me to find the issue :pray: ?

Are you sure that you clicked “Shift-Enter” directly on the function cell after you most recent change to it? If you don’t and just call the function again, it runs the old code.

One way to make sure that WYSIWYG is to do:

  1. Kernel → Restart and Clear Output
  2. Save
  3. Cell → Run All

Sorry, I hadn’t looked carefully enough when I wrote that first reply: your code is actually wrong. Check again the final formula. You are handling \epsilon correctly, but your code does not follow the correct formula for the rest of what is in the denominator there.

Hello, I have the same problem, could you please send me this line of code you changed? Thank you very much!

Hi @hanqing_zhang ,

Your error may not be the same, so coping code does not help in finding out what the error is in your code. Start debugging by checking your code against the formula.

Moderator Edit: Solution Code Removed
Hello, I have checked my formula from top to bottom again and found no mistakes. Could you please help me look at it?

Hi @hanqing_zhang ,

epsilon should not be included in the np.sqrt().

I know, it is not included.

There is a mistake in your code for updating parameters (W and b). Check that again.

PS: Sharing your code is not allowed, so avoid sharing it.

Thank you very much. I have seen the error. W and b should be updated with correction values.