Hi,
What am I not understanding about double sums over several indicies???
My solution to L2 Reg is
L2_regularization_cost = (lambd/(2*m))*(np.sum(np.square(W1))+np.sum(np.square(W2)+np.sum(np.square(W3))))
I thought a sign was incorrect but that wasn’t it.
These are the shapes of the W3 W2 and W1
(1, 3) (3, 2) (2, 3)
But the checker gives me an error.
Error: Wrong output
1 Tests passed
1 Tests failed
AssertionError Traceback (most recent call last)
in
3 print("cost = " + str(cost))
4
----> 5 compute_cost_with_regularization_test(compute_cost_with_regularization)
~/work/release/W1A2/public_tests.py in compute_cost_with_regularization_test(target)
30 ]
31
—> 32 single_test(test_cases, target)
33
34 def backward_propagation_with_regularization_test(target):
~/work/release/W1A2/test_utils.py in single_test(test_cases, target)
118 print(’\033[92m’, success," Tests passed")
119 print(’\033[91m’, len(test_cases) - success, " Tests failed")
→ 120 raise AssertionError(“Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.”.format(target.name))
121
122 def multiple_test(test_cases, target):
AssertionError: Not all tests were passed for compute_cost_with_regularization. Check your equations and avoid using global variables inside the function.