C3_W2_Collaborative_RecSys_Assignment - Error

Hi,
I get an error in the code. However, the expected values with and without regularisation seem to be correct (13.67 and 28.09)
Could someone help me with the code please?

Hi @Thrasso00

Please make sure that you used the arguments that send to you as aparameter in function cofi_cost_func() to make your code generalize over all test cases

Best Regards,
Abdelrahman

Hi @AbdElRhaman_Fakhry,
Thank you for your help.
I didn’t understand your suggestion very well. If you mean the name of the arguments. I am using the argument names that came in the original code:
X, W, b, Y, Y, R, lambda_.

OK @Thrasso00

I think that the error in your code isn’t from the wrong implementation but it’s because the round up of data types(the size of data types) so that make sure in your implementation, you didn’t compute the cost and put the output in variable, and after that you doing sum over this variable, In the other words use the accumulation variable directly like ( += )

J += ...... * np.square((............... -  ..... ))

That would preserve the small fractions in your calculations ,
Also Make sure that you use regularisation

Best Regards,
Abdelrahman

Hi,
Thanks for your help now it works perfectly.