Skip to content

Commit

Permalink
Merge pull request #2164 from recommenders-team/hotfix-2163
Browse files Browse the repository at this point in the history
Fix #2163
  • Loading branch information
miguelgfierro committed Sep 9, 2024
2 parents 7b32452 + 84497f2 commit edca084
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions recommenders/models/deeprec/DataModel/ImplicitCF.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ def train_loader(self, batch_size):
"""

def sample_neg(x):
if len(x) >= self.n_items:
raise ValueError("A user has voted in every item. Can't find a negative sample.")
while True:
neg_id = random.randint(0, self.n_items - 1)
if neg_id not in x:
Expand Down

0 comments on commit edca084

Please sign in to comment.