Lightning-AI / torchmetrics

Machine learning metrics for distributed, scalable PyTorch applications.
https://lightning.ai/docs/torchmetrics/
Apache License 2.0
2.14k stars 408 forks source link

`pos_label` is missing from AUROC #1376

Closed zhiqiangdon closed 1 year ago

zhiqiangdon commented 1 year ago

🐛 Bug

The pos_label argument is missing from AUROC/BinaryAUROC after the recent cleanup: https://github.com/Lightning-AI/metrics/pull/1252

I guess this is a bug, but would like confirm with you.

To Reproduce

Steps to reproduce the behavior...

Code sample

Expected behavior

Environment

Additional context

github-actions[bot] commented 1 year ago

Hi! thanks for your contribution!, great first issue!

SkafteNicki commented 1 year ago

Hi @zhiqiangdon, thanks for reporting this issue. In this case it is not an error but instead an explicit design decision. We standardized all binary classification metrics to always require the target to be encoded as [0,1] where the positive class will then be the 1 class. If you want the 0 class to be the positive class then feed targets as

BinaryAUROC()(preds, 1-target)

Sorry for the confusion. I created PR #1383 that will explicit mention that 1 is always considered the positive class.

zhiqiangdon commented 1 year ago

Thanks @SkafteNicki! Clarifying this change in documents is super helpful!