We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c754c3a commit a15879eCopy full SHA for a15879e
lenskit/algorithms/als/implicit.py
@@ -1,6 +1,7 @@
1
from __future__ import annotations
2
3
import logging
4
+import math
5
from typing import Optional
6
7
import numpy as np
@@ -113,6 +114,7 @@ def prepare_data(self, ratings: pd.DataFrame) -> TrainingData:
113
114
ratings = ratings[["user", "item"]]
115
116
rmat, users, items = sparse_ratings(ratings, torch=True)
117
+ rmat.values().multiply_(self.weight)
118
return TrainingData.create(users, items, rmat)
119
120
def initial_params(self, nrows: int, ncols: int) -> torch.Tensor:
@@ -248,4 +250,4 @@ def _train_implicit_cholesky_fanout(
248
250
sqerr += torch.dot(diff, diff)
249
251
ctx.left[start:end, :] = M
252
- return sqerr.item()
253
+ return math.sqrt(sqerr.item())
0 commit comments