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

Add prefix arg to metric collection #70

Merged
merged 7 commits into from
Mar 14, 2021

Conversation

SkafteNicki
Copy link
Member

@SkafteNicki SkafteNicki commented Mar 13, 2021

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?

Fixes #64
Adds a prefix argument to the metric collection for easy initialization of the same metric collection multiple times with adjusted keys

mc = MetricCollection([Accuracy, Precision, Recall], prefix='train_')
out = mc(...)
# keywords of output dict will be "train_Accuracy", "train_Precision", "train_Recall"

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 13, 2021

Codecov Report

Merging #70 (4c7d878) into master (75570f6) will decrease coverage by 0.03%.
The diff coverage is 95.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #70      +/-   ##
==========================================
- Coverage   97.11%   97.07%   -0.04%     
==========================================
  Files          59       59              
  Lines        1938     1949      +11     
==========================================
+ Hits         1882     1892      +10     
- Misses         56       57       +1     
Flag Coverage Δ
Linux 78.54% <80.00%> (-0.04%) ⬇️
Windows 78.54% <80.00%> (-0.04%) ⬇️
cpu 97.07% <95.00%> (-0.04%) ⬇️
macOS 97.07% <95.00%> (-0.04%) ⬇️
pytest 97.07% <95.00%> (-0.04%) ⬇️
python3.6 97.06% <95.00%> (-0.04%) ⬇️
python3.8 97.07% <95.00%> (-0.04%) ⬇️
python3.9 97.07% <95.00%> (-0.04%) ⬇️
torch1.3.1 95.31% <95.00%> (-0.03%) ⬇️
torch1.4.0 95.48% <95.00%> (-0.03%) ⬇️
torch1.8.0 97.07% <95.00%> (-0.04%) ⬇️

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

Impacted Files Coverage Δ
torchmetrics/collections.py 97.91% <94.73%> (-2.09%) ⬇️
torchmetrics/__init__.py 100.00% <100.00%> (ø)

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 75570f6...4c7d878. Read the comment docs.

Copy link
Contributor

@carmocca carmocca left a comment

Choose a reason for hiding this comment

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

LGTM. Can you also add return type annotations?

docs/source/pages/overview.rst Outdated Show resolved Hide resolved
docs/source/pages/overview.rst Outdated Show resolved Hide resolved
docs/source/pages/overview.rst Outdated Show resolved Hide resolved
@Borda Borda force-pushed the fix_metriccollection_prefix_arg branch from 95f8535 to a5cb115 Compare March 13, 2021 16:38
@SkafteNicki SkafteNicki merged commit c32d3e5 into master Mar 14, 2021
@SkafteNicki SkafteNicki deleted the fix_metriccollection_prefix_arg branch March 14, 2021 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

log_dict is missing prefix parameter that is mentioned in docs
3 participants