C3_W2_Collaborative_RecSys_Assignment public test error

Hello, I encountered this error while running the public test. Is this possible while the two tests above yield the correct value?
Thank you

1 Like

Yes, it is possible. There are multiple tests.

This means your cofi_cost_func() function does not return the correct value for the test defined in test_cofi_cost_func().

1 Like

Hello, what do you suggest to fix this? I’m not sure where the error occurred in my code.

found the problem, thanks

1 Like

Could you please tell us how you solve it?

1 Like

1 Like

Need help here!
The regularization term matches with the hints provided but the output does not match.
image

1 Like

@Sumaiya639, did you use all of the hint code?

hello, instead of using b_j as defined, I mistakenly used b in the equation.

1 Like

check your cofi_cost_func equation. In the ‘for i’ loop I think the r term should be outside the np.square() instead of inside like the one in hint.

1 Like

Yeah,
I used regularization term outside the loop then it worked.

Thanks

1 Like

I am facing the same issue. How did you fix the issue?

1 Like

Please help

1 Like

1 Like

hello, please check your cofi_cost_func equation. Try to move the ‘r’ term outside np.square() instead of inside like the one shown in the hint.

1 Like

I believe the hint code is correct.

Note that your result is exactly 2x the correct value. Maybe that is significant.

Thank you.

I moved r function outside i loop and non-regularized and regularized output is correct now.
But i still see issues when i ran the third one. I still see an error there, I am not sure if I am missing anything still…

1 Like

I got it now :slight_smile:
I forgot to implement r outside np.square, now i did and it worked.

Thanks a lot

1 Like

I am unsure of what you mean by moving the ‘r’ term outside np.square().
Could you please explain?

I did this way and worked!

{Mentor edit: code removed: Sharing your code on the forum is not allowed by
the Code of Conduct}