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 map #968

Merged
merged 31 commits into from Nov 8, 2020
Merged

Recsys map #968

merged 31 commits into from Nov 8, 2020

Conversation

zkid18
Copy link
Contributor

@zkid18 zkid18 commented Oct 19, 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 19, 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-08 07:18:39 UTC

@zkid18 zkid18 changed the title Recsys map Recsys map [WIP] Oct 19, 2020
Calculate the Average Precision (AP) for recsys
The precision metric summarizes the fraction of relevant items
out of the whole the recommendation list.
The average precision @ k (AP@k) metrics summarizes the average
Copy link
Member

Choose a reason for hiding this comment

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



def avg_precision(
outputs: torch.Tensor, targets: torch.Tensor, 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.

k=10?

@@ -0,0 +1,64 @@
import numpy as np
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 from recsys course?

) / float(index + 1)

ap = torch.mean(precisions, dim=1)
return ap
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 add docs, that we return Tensor with shape [bs]?

Copy link
Member

Choose a reason for hiding this comment

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

and could we also add mean_avg_precision metric here?

@mergify mergify bot dismissed Scitator’s stale review October 31, 2020 10:07

Pull request has been modified.

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

Pull request has been modified.

import torch


def dcg(
Copy link
Member

Choose a reason for hiding this comment

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

not sure if we need it here :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

extra spaces or dcg method?


import numpy as np

import torch
Copy link
Member

Choose a reason for hiding this comment

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

and this one :)

Scitator
Scitator previously approved these changes Nov 3, 2020
@mergify mergify bot dismissed Scitator’s stale review November 7, 2020 02:39

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? 🙏

@Scitator Scitator merged commit cc441db into catalyst-team:master Nov 8, 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

4 participants