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

Fix issue in calculating NDCG when input data is smaller than K #1007

Merged
merged 3 commits into from
Mar 14, 2024

Conversation

oriol-guitart-edo
Copy link
Contributor

This PR tries to fix the open issue which appears when some users have less recommendations than the K

@emeli-dral
Copy link
Contributor

Hi @oriol-guitart-edo ,
Thank you for your contribution!

I believe reasons of failed tests are formatting and a missing bracket.
I suggest you try to fix the 55 line in the file like that: idcg = df.groupby("users").target.apply(lambda x: x[:i].dot(discount[: len(x)])).rename("idcg") (add and extra bracket after "len(x)]" and add a space in "[: len(x)]")

@oriol-guitart-edo
Copy link
Contributor Author

Yes, it is fixed. Hopefully, it will pass the tests now

@emeli-dral
Copy link
Contributor

Looks like there is still an issue with black formatter.
Here is a way how you can check it locally: black -l 120 -t py38 ndcg_k.py
I believe it is only a missing whitespace here: [: len(x)]

@emeli-dral emeli-dral merged commit f1cbc7e into evidentlyai:main Mar 14, 2024
22 checks passed
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