Skip to content

Filter negative gains in NDCG calculation#1065

Merged
mdekstrand merged 6 commits intolenskit:mainfrom
samiravaez:bugfix/ndcg
Apr 7, 2026
Merged

Filter negative gains in NDCG calculation#1065
mdekstrand merged 6 commits intolenskit:mainfrom
samiravaez:bugfix/ndcg

Conversation

@samiravaez
Copy link
Copy Markdown
Contributor

Thi PR resolves #1057 by clipping negative gains to zero in both the computed DCG and the ideal DCG.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.46%. Comparing base (6f33824) to head (e2b71b5).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1065   +/-   ##
=======================================
  Coverage   89.45%   89.46%           
=======================================
  Files         233      233           
  Lines       15870    15874    +4     
=======================================
+ Hits        14197    14201    +4     
  Misses       1673     1673           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +116 to +117
if ideal == 0:
return 0.0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this is probably a good idea.

@mdekstrand
Copy link
Copy Markdown
Member

Can we add a note on clipping the gains to the documentation?

@mdekstrand mdekstrand added this to the 2026.1 milestone Apr 6, 2026
@mdekstrand mdekstrand self-assigned this Apr 6, 2026
@mdekstrand mdekstrand merged commit ca1ee7a into lenskit:main Apr 7, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update NDCG to filter negative gains from ideal list

2 participants