Skip to content

Commit

Permalink
make a copy of matrix for normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
mdekstrand committed Jun 7, 2024
1 parent 76ebe8a commit 3f3a770
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lenskit/lenskit/algorithms/svd.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def fit(self, ratings, **kwargs):
r_mat, users, items = sparse_ratings(
ratings, layout="coo", users=u_bias.index, items=i_bias.index
)
# global
r_mat.data -= g_bias
# copy the data and start subtracting
r_mat.data = r_mat.data - g_bias
r_mat.data -= i_bias.values[r_mat.col]
r_mat.data -= u_bias.values[r_mat.row]
r_mat = r_mat.tocsr()
Expand Down

0 comments on commit 3f3a770

Please sign in to comment.