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

Recsys dcg #975

Merged
merged 33 commits into from Nov 9, 2020
Merged

Recsys dcg #975

merged 33 commits into from Nov 9, 2020

Conversation

zkid18
Copy link
Contributor

@zkid18 zkid18 commented Oct 26, 2020

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contribution guide?
  • Did you check the code style? catalyst-make-codestyle && catalyst-check-codestyle (pip install -U catalyst-codestyle).
  • Did you make sure to update the docs? We use Google format for all the methods and classes.
  • Did you check the docs with make check-docs?
  • Did you write any new necessary tests?
  • Did you check that your code passes the unit tests pytest . ?
  • Did you add your new functionality to the docs?
  • Did you update the CHANGELOG?

Description

Related Issue

Type of Change

  • Examples / docs / tutorials / contributors update
  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves an existing feature)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to 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

  • I know, that I could join slack for pull request discussion.

@pep8speaks
Copy link

pep8speaks commented Oct 26, 2020

Hello @zkid18! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-11-09 05:25:54 UTC

@mergify
Copy link

mergify bot commented Oct 26, 2020

This pull request is now in conflicts. @zkid18, could you fix it? 🙏


def dcg(
outputs: torch.Tensor, targets: torch.Tensor,
gain_function=lambda x: torch.pow(2, x) - 1, k=100
Copy link
Member

Choose a reason for hiding this comment

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

types please

Copy link
Member

Choose a reason for hiding this comment

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

maybe k=10?

gain_function=lambda x: torch.pow(2, x) - 1, k=100
) -> torch.Tensor:
"""
Computes DCG@topk for the specified values of `topk`.
Copy link
Member

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 Show resolved Hide resolved
gain_function=lambda x: torch.pow(2, x) - 1, k=100
) -> torch.Tensor:
"""
Computes nDCG@topk for the specified values of `topk`.
Copy link
Member

Choose a reason for hiding this comment

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

topK :)

list with computed ndcg@topk
"""
ideal_dcgs = dcg(targets, targets, gain_function, k)
ndcg = dcg(outputs, targets, gain_function, k) / ideal_dcgs
Copy link
Member

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
Copy link
Member

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?

Daniel Chepenko added 2 commits October 26, 2020 14:55
This reverts commit 9950d7d.
Removed movielens by mistake
@mergify mergify bot dismissed Scitator’s stale review October 26, 2020 06:01

Pull request has been modified.

@zkid18 zkid18 changed the title Recsys dcg [WIP] Recsys dcg Nov 2, 2020
Scitator
Scitator previously approved these changes Nov 2, 2020
@mergify mergify bot dismissed Scitator’s stale review November 3, 2020 08:15

Pull request has been modified.

@mergify
Copy link

mergify bot commented Nov 7, 2020

This pull request is now in conflicts. @zkid18, could you fix it? 🙏

@mergify
Copy link

mergify bot commented Nov 8, 2020

This pull request is now in conflicts. @zkid18, could you fix it? 🙏

@Scitator Scitator merged commit 71d9d2a into catalyst-team:master Nov 9, 2020
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

5 participants