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

Blazing fast bootstrap stderrs for AUROC #190

Merged
merged 58 commits into from
Apr 16, 2023
Merged

Blazing fast bootstrap stderrs for AUROC #190

merged 58 commits into from
Apr 16, 2023

Conversation

norabelrose
Copy link
Member

@norabelrose norabelrose commented Apr 15, 2023

Adds bootstrap standard errors everywhere we report AUROC figures, fixing #116.

Doing this the naive way with sklearn.metrics.roc_auc_score turned out to be quite slow (over a full second on CPU for each layer). Luckily GPT-4 helped me write a custom PyTorch implementation of AUROC that supports batching, so the computation can be vectorized across all the bootstrap resampled datasets at once. The relevant functions are roc_auc and roc_auc_ci in elk.metrics. Even when run on the CPU, roc_auc_ci is much faster (~20x) than the naive for-loop baseline; on GPU it's of course even faster than that. Basically the bootstrap CI is no longer a significant bottleneck, so you might as well use roc_auc_ci wherever you want to compute an AUROC.

This PR does depend on #179 even though it probably doesn't need to, because I was too lazy to rebase. I'm hoping #179 will get merged today anyway so it won't matter.

As a bonus, this PR allows us to get rid of our dependency on sklearn, although we do still need it as a [dev] dependency for the tests.

norabelrose and others added 30 commits April 4, 2023 11:28
@norabelrose norabelrose merged commit 7b4a00c into main Apr 16, 2023
4 checks passed
@norabelrose norabelrose deleted the roc_auc branch April 16, 2023 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants