The code I’ve written passes all the tests except for the last one. The error message is “Wrong value. Expected 13.621929978531858, got 12.672019395081678.”
The regularization term values I’ve computed are 8.015224040196546 for X and 4.414542034361463 for W. The sum of all the losses is 0.24225332052366916 so the final cost ends up being less that 13.6
Which test are you running? Please post a screen capture image.
Be careful how you’re handling the scaling of the regularized part of the cost by the lambda_ value. It’s easy to mess this up with incorrect parenthesis.
The instructions for implementing cofi_cost_func says " Note that you should be accumulating the cost for user j and movie i only if R(i,j) = 1.". Which I implemented but when I remove that condition ( if R[i,j] != 1 : break ) from the last loop it passes all the tests now.
Just following the instructions to implement a for loop. Do you know why the instruction says to only consider if R[i,j] = 1 when doing so causes the function to fail one of the test ?