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

Python generalized ndcg #1812

Merged
merged 7 commits into from
Sep 20, 2022
Merged

Python generalized ndcg #1812

merged 7 commits into from
Sep 20, 2022

Conversation

ChuyangKe
Copy link
Contributor

@ChuyangKe ChuyangKe commented Aug 18, 2022

Description

Implemented a generalized version of NDCG. The function now supports three types of relevance scores: binary, raw, and exponential. It also supports two types of discount functions: natural log, and log2.

Related Issues

Related to issue: #1749. The example is added as a new test case for raw relevance scores.

Checklist:

  • I have followed the contribution guidelines and code style for this project.
  • I have added tests covering my contributions.
  • I have updated the documentation accordingly.
  • This PR is being made to staging branch and not to main branch.

@@ -185,7 +185,7 @@ def test_python_ndcg_at_k(rating_true, rating_pred):
col_prediction=DEFAULT_PREDICTION_COL,
k=10,
)
assert t.interval < 21.55627936 * (1 + TOL)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new version takes more time, because for raw and exp scores, we need to sort the dataframe based on the true ratings. We can probably use the old version for binary, and new version for raw and exp.

Copy link
Collaborator

@miguelgfierro miguelgfierro left a comment

Choose a reason for hiding this comment

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

looks great!

@miguelgfierro miguelgfierro merged commit 8c82e23 into staging Sep 20, 2022
@miguelgfierro miguelgfierro deleted the chuyang/generalized_ndcg branch September 20, 2022 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants