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
Recsys dcg #975
Recsys dcg #975
Conversation
This pull request is now in conflicts. @zkid18, could you fix it? 🙏 |
catalyst/metrics/ndcg.py
Outdated
|
||
def dcg( | ||
outputs: torch.Tensor, targets: torch.Tensor, | ||
gain_function=lambda x: torch.pow(2, x) - 1, k=100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
types please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe k=10
?
catalyst/metrics/ndcg.py
Outdated
gain_function=lambda x: torch.pow(2, x) - 1, k=100 | ||
) -> torch.Tensor: | ||
""" | ||
Computes DCG@topk for the specified values of `topk`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k
and topk
naming? :)
catalyst/metrics/ndcg.py
Outdated
gain_function=lambda x: torch.pow(2, x) - 1, k=100 | ||
) -> torch.Tensor: | ||
""" | ||
Computes nDCG@topk for the specified values of `topk`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
topK
:)
catalyst/metrics/ndcg.py
Outdated
list with computed ndcg@topk | ||
""" | ||
ideal_dcgs = dcg(targets, targets, gain_function, k) | ||
ndcg = dcg(outputs, targets, gain_function, k) / ideal_dcgs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we make something like
predicted_dcgs = dcg(outputs, targets, gain_function, k)
ndcg = predicted_dcgs / ideal_dcgs
@@ -0,0 +1,45 @@ | |||
import math |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we also add tests for dcg?
This reverts commit 9950d7d. Removed movielens by mistake
Pull request has been modified.
Pull request has been modified.
This pull request is now in conflicts. @zkid18, could you fix it? 🙏 |
This pull request is now in conflicts. @zkid18, could you fix it? 🙏 |
Before submitting
catalyst-make-codestyle && catalyst-check-codestyle
(pip install -U catalyst-codestyle
).make check-docs
?pytest .
?Description
Related Issue
Type of Change
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
PS