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

Implement MultioutputWrapper #510

Merged
merged 45 commits into from
Sep 24, 2021
Merged

Implement MultioutputWrapper #510

merged 45 commits into from
Sep 24, 2021

Conversation

an1lam
Copy link
Contributor

@an1lam an1lam commented Sep 9, 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?

Implements the MultioutputWrapper feature described in #508. Summarizing, MultioutputWrapper takes a base metric and a num_outputs param and returns a metric that will compute shape[output_dim] many scalars and return them in a list. The idea is to support multioutput mode for metrics like SpearmanCorrcoef that don't support it natively.

@an1lam
Copy link
Contributor Author

an1lam commented Sep 9, 2021

I'm not sure why the build is failing but it seems to be totally independent of my change & instead has to do with Docker. It looks like it's also failing on #506, so I'm assuming this is not caused by my change?

@SkafteNicki SkafteNicki mentioned this pull request Sep 9, 2021
4 tasks
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.

Few comments, PR is looking good already :]

torchmetrics/wrappers/multioutput.py Show resolved Hide resolved
torchmetrics/wrappers/multioutput.py Outdated Show resolved Hide resolved
tests/wrappers/test_multioutput.py Outdated Show resolved Hide resolved
torchmetrics/wrappers/multioutput.py Outdated Show resolved Hide resolved
an1lam and others added 6 commits September 9, 2021 09:27
- In order to handle cases like `BinnedAveragePrecision`, add
  `squeeze_outputs` argument which defaults to true and change
  `compute()`'s return type to a list.
- Add two examples to the docs.
@codecov
Copy link

codecov bot commented Sep 9, 2021

Codecov Report

Merging #510 (ea45a8f) into master (9ef98b4) will decrease coverage by 1%.
The diff coverage is 90%.

@@          Coverage Diff          @@
##           master   #510   +/-   ##
=====================================
- Coverage      95%    95%   -1%     
=====================================
  Files         132    133    +1     
  Lines        4660   4717   +57     
=====================================
+ Hits         4444   4467   +23     
- Misses        216    250   +34     

@an1lam
Copy link
Contributor Author

an1lam commented Sep 10, 2021

@SkafteNicki not exactly sure at what point I move this out of draft mode/whether I am the one supposed to do it. Let me know!

@SkafteNicki
Copy link
Member

@an1lam Changed it to review status, to get all test running.

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.

I am basically fine with the PR as it is, but it would be great to further improve the testing (I doubt it will show any problems as this is just a wrapper around other metrics) :]

tests/wrappers/test_multioutput.py Outdated Show resolved Hide resolved
@SkafteNicki
Copy link
Member

Hi @an1lam, please check your examples, they do not seem to render correctly:
image

@an1lam
Copy link
Contributor Author

an1lam commented Sep 21, 2021

@SkafteNicki good catch, sorry. I fixed them:
Screen Shot 2021-09-21 at 11 59 41 AM

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 :]

@mergify mergify bot added the ready label Sep 21, 2021
@SkafteNicki
Copy link
Member

GPU test are failing due to this issue: #531
Because you have the metric as a child module when doing the testing the self.device attribute does not get proper update due to the above issue.

@an1lam
Copy link
Contributor Author

an1lam commented Sep 21, 2021

@SkafteNicki do you think I should wait until you merge #542 then (and merge master afterwards) to merge?

@SkafteNicki
Copy link
Member

@an1lam yes that PR should fix the last test that fails here :]

@Borda Borda enabled auto-merge (squash) September 22, 2021 08:44
@SkafteNicki SkafteNicki added this to the v0.6 milestone Sep 24, 2021
@Borda Borda merged commit 5893793 into Lightning-AI:master Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement MultioutputWrapper
3 participants