2 years ago
#38119
user123
AUROC for imbalanced dataset
this is my first question here and I hope you can help me.
At the moment I'm training a binary classifier for medical images and my dataset is imbalanced with a ratio of roughly 0.8 (negative) to 0.2 (positive). My code is written with pytorch and pytorch lightning and I am using torchmetrics for evaluation.
So my question is if the torchmetrics AUROC is a good choice as evaluation metric for my model and if anyone has used it themselves for a similar dataset. The parameter average="weighted" should account for imbalance.
My implementation:
auroc_val = AUROC(num_classes=2, average="weighted")
auroc_val(prediction, target)
Torchmetrics link:
https://torchmetrics.readthedocs.io/en/latest/references/modules.html#auroc
Source code:
My understanding is that this implementation should work fine and the results look legit but I am asking because I already ran into some pitfalls when it comes to model evaluation.
Thanks in advance, comments on this are much appreciated!
pytorch
metrics
evaluation
imbalanced-data
pytorch-lightning
0 Answers
Your Answer