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

Bugfix for using metric collection and aggregation metric #1896

Merged
merged 10 commits into from
Jul 12, 2023

Conversation

SkafteNicki
Copy link
Member

@SkafteNicki SkafteNicki commented Jul 9, 2023

What does this PR do?

Fixes #1890

Essentially, if a user provides a single value like torch(1.0) then the state of SumMetric, MeanMetric, MinMetric, MaxMetricis the exact same after the firstmetric.update` call (sum(1) == mean(1) == max(1) == min(1)). In this case metric collection interprets that these should be in the same compute group, which is wrong.
Fixes this by given unique state names

Before submitting
  • Was this discussed/agreed 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?
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 🙃


📚 Documentation preview 📚: https://torchmetrics--1896.org.readthedocs.build/en/1896/

@SkafteNicki SkafteNicki added the bug / fix Something isn't working label Jul 9, 2023
@SkafteNicki SkafteNicki added this to the v1.1.0 milestone Jul 9, 2023
@codecov
Copy link

codecov bot commented Jul 9, 2023

Codecov Report

Merging #1896 (acb0e35) into master (e1fd252) will increase coverage by 0%.
The diff coverage is 100%.

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #1896   +/-   ##
======================================
  Coverage      85%     85%           
======================================
  Files         262     262           
  Lines       15049   15052    +3     
======================================
+ Hits        12798   12801    +3     
  Misses       2251    2251           

@mergify mergify bot added the ready label Jul 9, 2023
@mergify mergify bot removed the has conflicts label Jul 10, 2023
@Borda Borda enabled auto-merge (squash) July 10, 2023 06:41
@Borda Borda requested a review from a team July 10, 2023 22:37
@mergify mergify bot removed the has conflicts label Jul 11, 2023
@Borda Borda merged commit a448ad3 into master Jul 12, 2023
@Borda Borda deleted the bugfix/metric_collection_and_aggregation branch July 12, 2023 17:25
Borda pushed a commit that referenced this pull request Jul 13, 2023
Borda pushed a commit that referenced this pull request Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug / fix Something isn't working ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MinMetric produces incorrect result when used with MetricCollection and compute_groups=True
3 participants