📏  One-vs-Rest (OvR) AUROC

One-vs-Rest (OvR) AUROC#

Multiclass AUROC obtained by scoring each class against all others and averaging.

Important

✨ AI-generated content. This page was written with the assistance of an AI language model and is provided as a learning aid. Despite careful review, it may still contain mistakes, omissions, or out-of-date information. Whether you are new to the topic, a team lead, or a senior practitioner, treat it as a starting point rather than an authoritative reference: read it critically and independently verify anything you act on (code, commands, figures, and factual claims) against official documentation and primary sources before relying on it.

What it is#

AUROC is only defined for a binary problem, so to score a \(K\)-class model we reduce it to \(K\) binary ones with One-vs-Rest (OvR): for each class \(i\), treat class \(i\) as positive and all other classes together as negative, and compute that binary AUROC.

\[\text{AUROC}_{\text{OvR}}(i) = \text{AUROC}(\text{class}_i \;\text{vs}\; \text{rest}).\]

Each value measures how well the model separates that one class from everything else.

From per-class to a single number#

You can report the per-class AUROCs directly, or average them into macro AUROC:

\[\text{AUROC}_{\text{macro}} = \frac{1}{K} \sum_{i=1}^{K} \text{AUROC}_{\text{OvR}}(i).\]

(Pooling the OvR decisions instead of averaging gives micro AUROC; averaging, as here, weights every class equally.)

Worked example#

Three classes with AUROC(A vs rest)=0.83, AUROC(B vs rest)=0.76, AUROC(C vs rest)=0.70:

  • Per class, these show A is the easiest to separate and C the hardest.

  • Macro AUROC \(= (0.83 + 0.76 + 0.70)/3 = 0.763\).

When it’s useful#

OvR AUROC gives a per-class, threshold-free read on discrimination — exactly what you want to answer “how well does the model pick out this class from the rest?”. It is especially informative for imbalanced problems (e.g. a rare fraud class), where a single global score can hide a weak minority.

In code#

from sklearn.metrics import roc_auc_score

per_class = roc_auc_score(y_true, y_score, multi_class="ovr", average=None)
macro = roc_auc_score(y_true, y_score, multi_class="ovr", average="macro")

Theme: Classification & Averaging Metrics  ·  All terminology



See also

Source article Adapted (context, re-expressed) in our own words from: One-vs-Rest (OvR) AUROC (insightful-data-lab.com).

Tags: purpose: reference topic: terminology level: intermediate