LINK:Coursera | Online Courses & Credentials From Top Educators. Join for Free | Coursera
I cannot pass the first assignment as there is something wrong with the regularization parameter. Can someone help?
see problem screenshot below
problem:my cost with regularized parameter is too high
Hello @LordAaravian,
Thanks for sharing just the results
A common issue here is the indentation. Wrong indentation might move code into a loop, and if the code adds to the cost, the resulting cost will be too large because that addition is looped for multiple times. My suggestion would be to check the cost formula again, and see that the “regularization” part of the cost should be outside of the loops of nu
and nm
, and make sure your code sticks to the formula.
Note that indentation decides what is inside and outside of a loop.
Cheers,
Raymond
1 Like
Thanks for the advice.
I updated the indentation, but came across a problem again: the cost is too low.
This is another common issue and is about lambda_
. It is either that you have not used lambda_
, or you have divided it by 2 for more than once. Below are two examples you can divide x
by 2 for two times:
x = 4
# situation 1
x = x / 2 / 2
print(x) # gives 1
x = 4
# situation 2
x = x / 2
x = x / 2
print(x) # gives 1
Note that the regularization term only takes one divided-by-2:
Check your code again
Cheers,
Raymond
1 Like