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

Fix auc calculation and add tests #197

Merged
merged 10 commits into from
Apr 26, 2021
Merged

Conversation

maximsch2
Copy link
Contributor

@maximsch2 maximsch2 commented Apr 22, 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 #195
Closes #196

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 Apr 22, 2021

Codecov Report

Merging #197 (92582c7) into master (2584345) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #197      +/-   ##
==========================================
+ Coverage   96.63%   96.65%   +0.02%     
==========================================
  Files         180      180              
  Lines        5760     5738      -22     
==========================================
- Hits         5566     5546      -20     
+ Misses        194      192       -2     
Flag Coverage Δ
Linux 79.88% <100.00%> (-0.05%) ⬇️
Windows 79.88% <100.00%> (-0.05%) ⬇️
cpu 96.65% <100.00%> (+0.02%) ⬆️
gpu 96.65% <ø> (+0.02%) ⬆️
macOS 96.65% <100.00%> (+0.02%) ⬆️
pytest 96.65% <100.00%> (+0.02%) ⬆️
python3.6 95.55% <100.00%> (+0.01%) ⬆️
python3.8 96.61% <100.00%> (+0.02%) ⬆️
python3.9 96.51% <100.00%> (+0.02%) ⬆️
torch1.3.1 95.55% <100.00%> (+0.01%) ⬆️
torch1.4.0 95.67% <100.00%> (+0.01%) ⬆️
torch1.8.1 96.51% <100.00%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
torchmetrics/utilities/data.py 96.42% <ø> (+0.97%) ⬆️
torchmetrics/functional/classification/auc.py 86.95% <100.00%> (-0.55%) ⬇️
__w/1/s/torchmetrics/average.py
__w/1/s/torchmetrics/retrieval/retrieval_recall.py
...s/torchmetrics/retrieval/mean_average_precision.py
...chmetrics/functional/classification/stat_scores.py
__w/1/s/torchmetrics/utilities/distributed.py
...1/s/torchmetrics/functional/retrieval/precision.py
...ics/functional/classification/matthews_corrcoef.py
...chmetrics/classification/precision_recall_curve.py
... and 172 more

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 2584345...92582c7. Read the comment docs.

@maximsch2 maximsch2 marked this pull request as ready for review April 22, 2021 22:05
@maximsch2
Copy link
Contributor Author

@maximsch2 maximsch2 changed the title WIP: fix auc calculation and add tests Fix auc calculation and add tests Apr 22, 2021
tests/classification/test_auc.py Show resolved Hide resolved
tests/classification/test_auc.py Outdated Show resolved Hide resolved
torchmetrics/functional/classification/auc.py Show resolved Hide resolved
@SkafteNicki
Copy link
Member

@maximsch2 I see your point that no matter what we do, we will never get stable sorting on cpu until torch v1.9 is released. Could you please add a note to the affected metrics, that users can expect slightly different results on cpu vs gpu.
Also add a TODO that this is something we probably should revisit in the future.

@Borda Borda added the bug / fix Something isn't working label Apr 23, 2021
@Borda Borda mentioned this pull request Apr 23, 2021
3 tasks
Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
@pep8speaks
Copy link

pep8speaks commented Apr 23, 2021

Hello @maximsch2! Thanks for updating this PR.

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

Comment last updated at 2021-04-23 14:17:17 UTC

@SkafteNicki SkafteNicki merged commit d432d3d into Lightning-AI:master Apr 26, 2021
@maximsch2 maximsch2 deleted the fix_auc branch April 26, 2021 22:14
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AUC computation is incorrect for tensors with >2048 elements.
5 participants