Test failed for update_parameters_with_adam method

Hello guys,

I’m having some trouble when validating the method update_parameters_with_adam.

The validation test shows a result of “Wrong values. Check your formulas for parameters[‘W1’]”. My result is:

W1 = 
[[ 1.63949493 -0.62691477 -0.54326465]
 [-1.08769515  0.85031501 -2.28657079]]
W2 = 
[[ 0.33262355 -0.26414959  1.47708248]
 [-2.0457142  -0.30744639 -0.36898502]
 [ 1.14872646 -1.09849003 -0.15727519]]
b1 = 
[[ 1.7549895]
 [-0.7461017]]
b2 = 
[[-0.89102966]
 [ 0.02699863]
 [ 0.56780324]]

while the expected results should be:

W1 = 
[[ 1.63942428 -0.6268425  -0.54320974]
 [-1.08782943  0.85036983 -2.2865723 ]]
W2 = 
[[ 0.33356139 -0.26425199  1.47707772]
 [-2.04538458 -0.30744933 -0.36903141]
 [ 1.14873036 -1.09256871 -0.15734651]]
b1 = 
[[ 1.75854357]
 [-0.74616067]]
b2 = 
[[-0.89228024]
 [ 0.02707193]
 [ 0.56782561]]

Even though the difference is quite small, I’ve reviewed my method multiple times and cannot see the problem. Could someone help me?

2 Likes

Hello @hazhor!

Double check your implementation of the formulas again. Can you spot the error?

Hint: What change, compared to the correct solution, would yield only a small difference? Which number is very small? :slight_smile:

5 Likes

Omg @jonaslalin ,

I misunderstood the formula in all the 3 or 4 times that I rechecked my implementation :frowning: :frowning:

I knew that would be probably something with the epsilon because of the small variations, as pointed out :grinning_face_with_smiling_eyes: :grinning_face_with_smiling_eyes:

Thanks for the help!

2 Likes

Glad to hear that @hazhor! Good luck on your deep learning journey :slight_smile:

1 Like

Glad to hear that you found the solution based on the very artful hint from @jonaslalin! :nerd_face: Would you also do us a favor and edit your post to remove the solution source code? The course rules are that we shouldn’t be publicly sharing solution code or it spoils everyone’s fun. Thanks!

1 Like

Sorry, @paulinpaloalto, thought the code would be important to find the error and so forgotten completely that rule :confused:

1 Like

Hi, @hazhor! Sure, it does definitely make it easier to help when we can see the code, so maybe the best idea is to reserve that for the difficult cases and also to make sure we erase the evidence once we’ve figured out the issue. Mind you, this example probably does qualify as a “difficult case”, since the effect on the answer between your solution and the fully correct one is pretty subtle :scream_cat:.

1 Like

I had the same issue and my initial results were identical. Seeing your post made me realize I wasn’t completely losing it! “Balance has been restored in the force”. Thanks!

1 Like

Hi @hazhor
I am getting the exact same error and I understood that it has something to do with the value of epsilon. But then again I cannot change the value of epsilon as it is being passed from the test function and is immutable. What should I do?
Thanks,
Kshitij Sharma

1 Like

I’m not sure if everyone else had the same problem as @kshitijsharma, but please pay attention to the position of epsilon in the formula. The image is a bit small in the notebook:

update_rule

Enjoy the rest of the course, @kshitijsharma! :slight_smile:

8 Likes

In the lecture video, this was still the issue. Epsilon was squished on the side. Is it possible to write the equations on the Jupiter notebook a little bigger?

Thank you for the feedback, @a2nath! I’ll forward your request to the DeepLearning.AI team to see if they can fix it. Good luck with the course! :slight_smile:

1 Like