C2 W2: Improving Deep Neural Networks Week 2 Programming Assignment

Hi, I have been stuck on this part of the assignment that is supposed to be updating the parameters using the Adam algorithm. I cant seem to find the issue in my code, any help is greatly appreciated !

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

{moderator edit - solution code removed}

Please have a more careful look at the mathematical expressions that you are implementing. Note that \epsilon is in the denominator, but is not under the square root, right?

I corrected the equation to the following and I am still getting the same error.

parameters["W" + str(l)] = parameters["W" + str(l)] - learning_rate * (v_corrected["dW" + str(l)]/np.sqrt(s_corrected["dW" + str(l)]) + epsilon)

But now \epsilon is not in the denominator, right? Please read my earlier description and examine the formula again. There were two possible “order of operations” mistakes to make there and now you’ve made both of them. :nerd_face:

Try this and watch what happens:

m = 5.
x = 1./3. + m
y = 1./(3. + m)

If you’re expecting x and y to have the same value, you’re in for an unpleasant surprise.