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

Metric bootstrapper #101

Merged
merged 45 commits into from
Mar 27, 2021
Merged

Metric bootstrapper #101

merged 45 commits into from
Mar 27, 2021

Conversation

SkafteNicki
Copy link
Member

@SkafteNicki SkafteNicki commented Mar 17, 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 #96
Implements a wrapper metric that allows the user to get bootstrapped metric values easily:

metric = BootStrapper(Accuracy(), num_bootstraps=10)
metric.update(preds, target)
mean, std = metric.compute()

where mean, std will be the mean and standard deviation calculated over 10 different metrics that have each been updated with resampled (with replacement) versions of preds, target.
Efficient way to determine confidence interval for metric values.

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 Mar 17, 2021
@SkafteNicki SkafteNicki added this to the 0.3 milestone Mar 17, 2021
@codecov
Copy link

codecov bot commented Mar 18, 2021

Codecov Report

Merging #101 (03024d8) into master (386b7e4) will decrease coverage by 8.94%.
The diff coverage is 82.08%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #101      +/-   ##
==========================================
- Coverage   96.89%   87.95%   -8.95%     
==========================================
  Files         148      152       +4     
  Lines        4638     4757     +119     
==========================================
- Hits         4494     4184     -310     
- Misses        144      573     +429     
Flag Coverage Δ
Linux 79.20% <82.08%> (+0.03%) ⬆️
Windows 79.20% <82.08%> (+0.03%) ⬆️
cpu 79.20% <82.08%> (-17.69%) ⬇️
gpu 96.68% <ø> (-0.22%) ⬇️
macOS 79.20% <82.08%> (-17.69%) ⬇️
pytest 87.95% <82.08%> (-8.95%) ⬇️
python3.6 ?
python3.8 ?
python3.9 ?
torch1.4.0 ?
torch1.8.1 ?

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

Impacted Files Coverage Δ
torchmetrics/collections.py 73.46% <ø> (-24.49%) ⬇️
torchmetrics/wrappers/bootstrapping.py 79.31% <79.31%> (ø)
torchmetrics/__init__.py 100.00% <100.00%> (ø)
torchmetrics/utilities/imports.py 80.00% <100.00%> (+1.42%) ⬆️
torchmetrics/wrappers/__init__.py 100.00% <100.00%> (ø)
torchmetrics/utilities/distributed.py 22.85% <0.00%> (-74.29%) ⬇️
torchmetrics/classification/auc.py 47.61% <0.00%> (-52.39%) ⬇️
torchmetrics/functional/classification/auroc.py 46.15% <0.00%> (-40.01%) ⬇️
torchmetrics/metric.py 55.25% <0.00%> (-39.77%) ⬇️
torchmetrics/functional/regression/psnr.py 60.60% <0.00%> (-36.37%) ⬇️
... and 38 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 386b7e4...03024d8. Read the comment docs.

@SkafteNicki SkafteNicki marked this pull request as ready for review March 18, 2021 12:57
@pep8speaks
Copy link

pep8speaks commented Mar 23, 2021

Hello @SkafteNicki! Thanks for updating this PR.

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

Comment last updated at 2021-03-27 08:11:51 UTC

torchmetrics/wrappers/bootstrapping.py Outdated Show resolved Hide resolved
torchmetrics/utilities/imports.py Outdated Show resolved Hide resolved
@Borda Borda changed the title Metric bootstrapper Metric bootstrapper [wip] Mar 26, 2021
@Borda Borda removed the ready label Mar 26, 2021
@SkafteNicki SkafteNicki changed the title Metric bootstrapper [wip] Metric bootstrapper Mar 26, 2021
@SkafteNicki SkafteNicki enabled auto-merge (squash) March 26, 2021 14:45
@SkafteNicki SkafteNicki merged commit 165cff0 into master Mar 27, 2021
@SkafteNicki SkafteNicki deleted the bootstrap branch March 27, 2021 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bootstrap wrapper for metrics?
6 participants