Week 2 - Lab 1: Collaborative Filtering Recommender Systems

I am trying to complete this assignment but I am hitting an error while running the tests for the cost function implementation checks.


While the previous tests returned the correct data I am hitting an error that doesn’t seem related to the results computed by my code, but mostly to how I implemented it (or so it seems).
To run the computations only on the films rated by the users I have used Numpy’s array masking (e.g. valid_data = np.ma.masked_where(R == 0, Y)). I am wondering if that breaks something in the tests somehow.
If that’s the case I’ll change my implementation.

Ok, I found what was the issue.
In one test case only the regularization part was valid as there were no user reviews, so the sum of the masked matrix returned nan instead of 0.0

1 Like

Great work resolving it yourself, Michele @Jazzinghen!

Raymond