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.
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:
(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
Hint
Mind map — connected ideas
Macro AUROC (Macro-Averaged AUROC) · Micro AUROC · Macro F1 · Single-label Classification
Hint
More in Classification & Averaging Metrics
Accuracy · AUC (Area Under the Curve) · Average Precision (AP) · Binary Classification · Classification Probability · Discriminatory Power · F1-score · Gini Coefficient · Harmonic Mean · Log Loss (also called Logarithmic Loss or Cross-Entropy Loss) · Macro AUC · Macro AUROC (Macro-Averaged AUROC) · Macro Averaging · Macro F1
See also
Source article Adapted (context, re-expressed) in our own words from: One-vs-Rest (OvR) AUROC (insightful-data-lab.com).