I am stuck on the public test part of Exercise 1. In Exercise 1, I applied the non-regularized implementation of J inside the loop, and regularized it by multiplying the above by (lambda/2). However, while result for Evaluation of the cost function with regularization is incorrect, leading to an error on the public tests. Can someone please assist? The error I am getting is:
Wrong value. Expected 27, got 0.0. Check the regularization term
So your code did not return the correct cost in either test case that had a non-zero value for lambda.
In the 1st test, you have 23.92 instead of 28.09
In the 2nd test, you have 0.0 instead of 27.0
Do your tests where lambda = 0 give the correct results?
For debugging, start by inspecting your code for cofi_cost_func(), and be sure you’re using the correct variables, and that they are spelled correctly (including upper- vs lower-case letters).
Then, inspect that the code you added to cofi_cost_func() is using the same local variable names from the function parameter list - and that you are not using any global variable names from the notebook’s scope.