From Coursera Forum - Course 2 Week 1
Error in compute_cost_with_regularization_test(compute_cost_with_regularization) test
-ARAishvarya Raman
a day ago
Hi All,
I am getting error in the output of compute_cost_with_regularization_test(compute_cost_with_regularization)
The output is displayed as follows:
cost = 1.8433386503250353
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.
Also, I am not able to edit that particular cell, though I have edited that function still I am not able to understand why am I getting that particular error.
My Response:
S​ame here. Still trying to figure out what I’m doing wrong. Seems like you square, then sum over rows and columns, then add each of those for the number of weights. Did you use “np.linalg.norm”? I’ve tried a few different ways and I’m still running into issues. Let me know if you find anything, and thanks for posting!