C3_W2 Problems with regularization

Hi, I’m having issues implementing regularization. I keep ending up with a wrong value.

I’m not a mentor for that course and am not familiar with the material there, but note that your incorrect answer is exactly 10 times the expected value. That should be a pretty big clue as to the nature of your error. If you are dealing with L2 regularization, note that the regularization term usually is multiplied by \frac {1}{2m} in addition to the factor of \lambda, right? It would be worth carefully comparing your code to the mathematical formulas shown in that section of the assignment.

Here’s another thing to consider if you already included the \frac {1}{2m} term:

m = 5
x = 1 / 2 * m
y = 1 / (2 * m)
print("x = {x}")
print("y = {y}")

If you’re expecting that x and y will be equal, you’re in for a big surprise. :weary_cat:

1 Like

I’m still clueless

1 Like

Dear @richkg22,

Can you please send me your notebook via DM?
I’ll look into the issues and let you know the solutions.

Thank you for offering your help, but I finally got the solution

1 Like