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

Information Retrieval (4/5) #146

Merged
merged 8 commits into from
Mar 30, 2021
Merged

Information Retrieval (4/5) #146

merged 8 commits into from
Mar 30, 2021

Conversation

lucadiliello
Copy link
Contributor

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

What does this PR do?

Implements Recall (@k) for Information Retrieval. More info here.

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.

Did you have fun?

Make sure you had fun coding 🙃

@codecov
Copy link

codecov bot commented Mar 29, 2021

Codecov Report

Merging #146 (f190759) into master (dfc4c38) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #146      +/-   ##
==========================================
+ Coverage   96.77%   96.81%   +0.03%     
==========================================
  Files         156       80      -76     
  Lines        4842     2450    -2392     
==========================================
- Hits         4686     2372    -2314     
+ Misses        156       78      -78     
Flag Coverage Δ
Linux 79.34% <78.37%> (+0.08%) ⬆️
Windows 79.34% <78.37%> (+0.08%) ⬆️
cpu 96.81% <100.00%> (+0.03%) ⬆️
gpu ?
macOS 96.81% <100.00%> (+0.03%) ⬆️
pytest 96.81% <100.00%> (+0.03%) ⬆️
python3.6 96.80% <100.00%> (+0.03%) ⬆️
python3.8 96.81% <100.00%> (+0.03%) ⬆️
python3.9 96.81% <100.00%> (+0.03%) ⬆️
torch1.3.1 ?
torch1.4.0 95.75% <100.00%> (+0.05%) ⬆️
torch1.8.1 96.81% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
torchmetrics/retrieval/mean_average_precision.py 100.00% <ø> (ø)
torchmetrics/retrieval/mean_reciprocal_rank.py 100.00% <ø> (ø)
torchmetrics/retrieval/retrieval_precision.py 100.00% <ø> (ø)
torchmetrics/__init__.py 100.00% <100.00%> (ø)
torchmetrics/functional/__init__.py 100.00% <100.00%> (ø)
torchmetrics/functional/retrieval/__init__.py 100.00% <100.00%> (ø)
torchmetrics/functional/retrieval/recall.py 100.00% <100.00%> (ø)
torchmetrics/retrieval/__init__.py 100.00% <100.00%> (ø)
torchmetrics/retrieval/retrieval_metric.py 100.00% <100.00%> (ø)
torchmetrics/retrieval/retrieval_recall.py 100.00% <100.00%> (ø)
... and 80 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dfc4c38...f190759. Read the comment docs.

@Borda Borda added the enhancement New feature or request label Mar 29, 2021
@lucadiliello lucadiliello changed the title Information Retrieval (3/5) Information Retrieval (4/5) Mar 29, 2021
Copy link
Member

@SkafteNicki SkafteNicki left a comment

Choose a reason for hiding this comment

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

LGTM

tests/functional/test_retrieval.py Outdated Show resolved Hide resolved
tests/functional/test_retrieval.py Outdated Show resolved Hide resolved
tests/functional/test_retrieval.py Outdated Show resolved Hide resolved
tests/functional/test_retrieval.py Outdated Show resolved Hide resolved
torchmetrics/functional/retrieval/recall.py Show resolved Hide resolved
of the `Recall` over each query.

Args:
query_without_relevant_docs:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
query_without_relevant_docs:
miss_query_action:

the argument doe not help with the meaning so let's keep it compact

Copy link
Member

Choose a reason for hiding this comment

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

if we make this change then all the other retrieval metrics should also be changed

Copy link
Member

Choose a reason for hiding this comment

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

yes, or if you have any better name suggestions? @lucadiliello
cc: @PyTorchLightning/core-metrics

Copy link
Contributor Author

Choose a reason for hiding this comment

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

miss_query_action sounds good. I suggest also empty_target_action because this is the case when target.sum() == 0.

Copy link
Member

Choose a reason for hiding this comment

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

+1 for empty_target_action

Copy link
Member

Choose a reason for hiding this comment

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

agree with empty_target_action 🎉

@lucadiliello
Copy link
Contributor Author

Don't know why test CI testing - complete / pytest (macOS-10.15, 3.6, minimal) (pull_request) runs out of time. Every test was fine before being cancelled...

@Borda Borda merged commit f06488f into Lightning-AI:master Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants