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

allow MetricCollection with args #176

Merged
merged 11 commits into from
Apr 19, 2021
Merged

allow MetricCollection with args #176

merged 11 commits into from
Apr 19, 2021

Conversation

Borda
Copy link
Member

@Borda Borda commented Apr 18, 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?

Allow passing metrics as arguments...

# Example (input as arguments):
metrics = MetricCollection(
    Accuracy(),
    Precision(num_classes=3, average='macro'),
    Recall(num_classes=3, average='macro'),
)

reaction to #175 (comment)

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 🙃

@Borda Borda added the enhancement New feature or request label Apr 18, 2021
@codecov
Copy link

codecov bot commented Apr 18, 2021

Codecov Report

Merging #176 (229624c) into master (6116c45) will increase coverage by 0.08%.
The diff coverage is 94.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #176      +/-   ##
==========================================
+ Coverage   79.19%   79.28%   +0.08%     
==========================================
  Files          90       90              
  Lines        2850     2862      +12     
==========================================
+ Hits         2257     2269      +12     
  Misses        593      593              
Flag Coverage Δ
Linux 79.28% <94.11%> (+0.08%) ⬆️
Windows 79.28% <94.11%> (+0.08%) ⬆️
cpu 79.28% <94.11%> (+0.08%) ⬆️
macOS 79.28% <94.11%> (+0.08%) ⬆️
pytest 79.28% <94.11%> (+0.08%) ⬆️

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

Impacted Files Coverage Δ
torchmetrics/average.py 83.33% <ø> (ø)
torchmetrics/collections.py 78.33% <92.30%> (+4.33%) ⬆️
...hmetrics/classification/binned_precision_recall.py 96.77% <100.00%> (+0.10%) ⬆️

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 6116c45...229624c. Read the comment docs.

@Borda Borda enabled auto-merge (squash) April 18, 2021 08:14
@Borda
Copy link
Member Author

Borda commented Apr 19, 2021

@PyTorchLightning/core-metrics and @justusschock @SkafteNicki what do you think?

Copy link
Member

@justusschock justusschock left a comment

Choose a reason for hiding this comment

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

I like it. just some comments for the naming and to avoid iterating over the metrics twice :)

torchmetrics/collections.py Outdated Show resolved Hide resolved
torchmetrics/collections.py Outdated Show resolved Hide resolved
@pep8speaks
Copy link

pep8speaks commented Apr 19, 2021

Hello @Borda! Thanks for updating this PR.

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

Comment last updated at 2021-04-19 08:35:57 UTC

@Borda Borda merged commit bc5f9a9 into master Apr 19, 2021
@Borda Borda deleted the feat/MetricCollection-args branch April 19, 2021 08:57
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.

4 participants