Course1, Week2, Exercise 5

[Moderator edit: Code removed]

I am getting this error from the code above:
AssertionError Traceback (most recent call last)
in
14 print ("cost = " + str(cost))
15
—> 16 propagate_test(propagate)

~/work/release/W2A2/public_tests.py in propagate_test(target)
51 assert np.allclose(grads[‘dw’], expected_dw), f"Wrong values for grads[‘dw’]. {grads[‘dw’]} != {expected_dw}"
52 assert np.allclose(grads[‘db’], expected_db), f"Wrong values for grads[‘db’]. {grads[‘db’]} != {expected_db}"
—> 53 assert np.allclose(cost, expected_cost), f"Wrong values for cost. {cost} != {expected_cost}"
54 print(‘\033[92mAll tests passed!’)
55

AssertionError: Wrong values for cost. [[3.75577540e-04 5.08619180e-05 4.66946507e-01 8.38515932e-05]
[3.75577540e-04 5.08619180e-05 4.66946507e-01 8.38515932e-05]
[1.62537558e+00 2.12505086e+00 4.19465073e-02 2.00008385e+00]
[1.62537558e+00 2.12505086e+00 4.19465073e-02 2.00008385e+00]] != 2.0424567983978403

The unit test is telling you that your cost function is goofy, no? Study the cost function, carefully. Maybe, you are unsure of what to transpose in the dot function? I encourage you to take the time to study the mechanics of matrix/vector multiplications using your Google-Fu. The patience is well worth the effort, here. Calculus operations are not requited in the specialization, but you do need to know the basics of linear algebra.

As an (important!) aside, I have removed your proposed solution code from your post. This is not only disallowed under the course honor code, but also can provide a dis-service to your fellow learners. Only the traceback is allowed.