Skip to content

Commit

Permalink
fix neg sample eval bugs of diffrec and ldiffrec
Browse files Browse the repository at this point in the history
  • Loading branch information
BishopLiu committed Feb 27, 2024
1 parent 77a60ae commit 77b7cb6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion recbole/model/general_recommender/diffrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def full_sort_predict(self, interaction):
def predict(self, interaction):
item = interaction[self.ITEM_ID]
x_t = self.full_sort_predict(interaction)
scores = x_t[:, item]
scores = x_t[torch.arange(len(item)).to(self.device), item]
return scores

def calculate_loss(self, interaction):
Expand Down
2 changes: 1 addition & 1 deletion recbole/model/general_recommender/ldiffrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def full_sort_predict(self, interaction):
def predict(self, interaction):
item = interaction[self.ITEM_ID]
x_t = self.full_sort_predict(interaction)
scores = x_t[:, item]
scores = x_t[torch.arange(len(item)).to(self.device), item]
return scores


Expand Down

0 comments on commit 77b7cb6

Please sign in to comment.