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

Simple aggregation metrics #506

Merged
merged 44 commits into from
Oct 13, 2021
Merged

Simple aggregation metrics #506

merged 44 commits into from
Oct 13, 2021

Conversation

SkafteNicki
Copy link
Member

@SkafteNicki SkafteNicki commented Sep 8, 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 #505
Introduces a couple of simple aggregation metrics for aggregating simple streams of values.
As self.log in lightning do not accept user defined reduce_fx, it would be great if torchmetrics can supply some simple metrics for aggregating data. This PR implements MeanMetric (updated version of AverageMeter), SumMetric, MinMetric, MaxMetric and CatMetric that importantly also can deal with nan values (what started the issue).

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 🙃

@SkafteNicki SkafteNicki added the enhancement New feature or request label Sep 8, 2021
@SkafteNicki SkafteNicki added this to the v0.6 milestone Sep 8, 2021
@codecov
Copy link

codecov bot commented Sep 8, 2021

Codecov Report

Merging #506 (6461b90) into master (56dbfd2) will increase coverage by 0%.
The diff coverage is 99%.

@@          Coverage Diff          @@
##           master   #506   +/-   ##
=====================================
  Coverage      95%    95%           
=====================================
  Files         134    134           
  Lines        4809   4873   +64     
=====================================
+ Hits         4568   4632   +64     
  Misses        241    241           

@an1lam an1lam mentioned this pull request Sep 9, 2021
4 tasks
tests/bases/test_aggregation.py Show resolved Hide resolved
torchmetrics/aggregation.py Outdated Show resolved Hide resolved
torchmetrics/aggregation.py Outdated Show resolved Hide resolved
torchmetrics/aggregation.py Show resolved Hide resolved
torchmetrics/aggregation.py Show resolved Hide resolved
torchmetrics/aggregation.py Outdated Show resolved Hide resolved
@Borda Borda mentioned this pull request Oct 1, 2021
4 tasks
@mergify mergify bot removed the has conflicts label Oct 1, 2021
@Borda
Copy link
Member

Borda commented Oct 1, 2021

@SkafteNicki does it also addresses #49?

@SkafteNicki
Copy link
Member Author

@Borda no PR #556 does that :]

@mergify mergify bot removed the has conflicts label Oct 11, 2021
Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGTM !

CHANGELOG.md Show resolved Hide resolved
@mergify mergify bot added the ready label Oct 11, 2021
@Borda Borda self-requested a review October 13, 2021 07:59
@Borda Borda enabled auto-merge (squash) October 13, 2021 08:03
@mergify mergify bot removed the ready label Oct 13, 2021
@Borda Borda merged commit 39ca748 into master Oct 13, 2021
@Borda Borda deleted the aggregation branch October 13, 2021 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request New metric
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TorchMetrics: NaN-compatible variants for common Metrics functions [nan_(mean, sum, max)]
3 participants