C3_W2 Excercise 1 (regularized cost)

Hi. I’m completely stuck on this excercise. I can run and get the correct result for the cost function. But when I run the preloaded code in the next cell the regularized cost does not come out correctly. The error says I need to multiple by lambda. The code looks correct to me and I can’t edit it anyway. What do I do?

BTW. The vectorized version comes out correctly below so I’m very confused.

Please help.

It would appear there is an error in your function code. You don’t need to edit the test cells, they just call the functions that you modified.

Please post a screen capture image that shows the error message.

Here is the error message

And this is the pre-loaded cell for calculating the regularized cost… I can’t edit it and as you can see it’s outputting an incorrect value.

You can’t edit that cell it because you’re not supposed to.

The cell is returning the wrong value because your code in cofi_cost_func() doesn’t work correctly.

Update for those who find this thread later:

Be sure to implement the entire cost equation, including the “regularization” portion.

1 Like