Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyTorch_NCF fix, normalize running loss #537

Merged
merged 4 commits into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cornac/models/ncf/recom_ncf_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ def _fit_tf(self):
batch_users, batch_items, batch_ratings
),
)
count += len(batch_ratings)
sum_loss += _loss * len(batch_ratings)
count += len(batch_users)
sum_loss += len(batch_users) * _loss
if i % 10 == 0:
loop.set_postfix(loss=(sum_loss / count))

Expand Down Expand Up @@ -242,7 +242,7 @@ def _fit_pt(self):
optimizer.step()

count += len(batch_users)
sum_loss += loss.data.item()
sum_loss += len(batch_users) * loss.data.item()

if batch_id % 10 == 0:
loop.set_postfix(loss=(sum_loss / count))
Expand Down
Loading