Discriminatory Power
Discriminatory power is a score’s ability to separate two classes โ defaulters from non-defaulters, sick from healthy, responders from non-responders. It is a property of the ranking the score produces, independent of any threshold applied to it.
Before anything else, the terminology. In credit risk and diagnostics “discriminatory power” is a virtue, and a model with more of it is better. In fairness work “discrimination” is the harm being guarded against. The two senses sit in the same glossary and mean opposite things; nothing in a model’s discriminatory power says anything about whether it discriminates in the other sense.
Three measures, two answers
The standard measures are presented as interchangeable readings of one quantity.
- AUROC โ the probability that a randomly chosen positive scores above a randomly chosen negative. 0.5 is chance, 1.0 is perfect.
- Gini โ \(2 \times \text{AUROC} - 1\), reported in place of AUROC across finance.
- KS statistic โ the largest gap between the cumulative distributions of positives and negatives. In credit risk, practitioners commonly treat 0.4 to 0.6 as strong, though that is a convention rather than a result.
import numpy as np
from sklearn.metrics import roc_auc_score, average_precision_score
rng = np.random.default_rng(0)
n = 400_000
y = (rng.random(n) < 0.5).astype(int)
broad = np.where(y == 1, rng.normal(0.75, 1.0, n), rng.normal(0.0, 1.0, n))
spike = np.where(y == 1, rng.normal(4.0, 0.3, n), rng.normal(0.0, 1.0, n))
spike = np.where((y == 1) & (rng.random(n) > 0.30), rng.normal(0.0, 1.0, n), spike)
"""Model 'broad' separates everyone a little. Model 'spike' identifies 30% of the
positives with certainty and cannot tell the other 70% from the negatives."""
def ks_statistic(labels, score):
order = np.argsort(-score)
lab = labels[order]
return np.abs(np.cumsum(lab) / lab.sum() - np.cumsum(1 - lab) / (1 - lab).sum()).max()
for name, score in (("broad", broad), ("spike", spike)):
auc = roc_auc_score(y, score)
print(f" {name:<6} AUROC {auc:.4f} Gini {2 * auc - 1:.4f} KS {ks_statistic(y, score):.4f}"
f" average precision {average_precision_score(y, score):.4f}")
print("\nAUROC and Gini prefer 'broad'; KS prefers 'spike'. They are ranking different things.")
# broad AUROC 0.7020 Gini 0.4040 KS 0.2921 average precision 0.6914
# spike AUROC 0.6486 Gini 0.2973 KS 0.2990 average precision 0.7254
#
# AUROC and Gini prefer 'broad'; KS prefers 'spike'. They are ranking different things.
The two models are built to be different in kind. broad pushes every positive up a little. spike identifies 30% of the positives beyond doubt and is blind to the rest.
AUROC and Gini prefer broad, 0.7020 against 0.6486. KS prefers spike, 0.2990 against 0.2921. Average precision also prefers spike, 0.7254 against 0.6914. Four numbers, all described as discriminatory power, splitting two against two.
None is wrong. They summarize the same ROC information differently: AUROC averages performance over every threshold, KS reports the single best one, average precision weights the high-scoring region. A model that is mediocre everywhere and a model that is excellent in one place and useless elsewhere are genuinely different products, and which is better depends on what the score will be used for.
So “discriminatory power” is not one quantity. Choosing the measure is choosing what counts as separation, and a validation report that quotes one number has made that choice silently.
What it does not tell you
- It does not reduce errors. Discriminatory power is threshold-free; the count of false positives and false negatives is set by where the cut-off goes. A better-ranking model makes better trade-offs available, and the trade-off still has to be chosen โ see setting thresholds.
- It says nothing about calibration. A strictly increasing transformation preserves ranking and ties on the same evaluation set, so it preserves rank-based discrimination while changing probability values. A non-decreasing transformation with plateaus can introduce ties and change AUROC; a decreasing one can reverse the ranking. Calibration needs its own check.
- It does not ensure fairness. High discriminatory power can coexist with very different error rates by group, but unequal base rates do not force those differences for every score. Fairness parity describes the conditions under which particular criteria conflict.
- AUROC flatters rare-event models. On an imbalanced problem it can stay high while the precision at the operating point collapses โ the NearMiss article has a case where average precision falls fourfold and AUROC moves by six points.
Reporting it
Report the discrimination summary used and the actual operating-point metrics. The two-sided KS used here is the maximum absolute TPR-minus-FPR gap over thresholds. A directional maximum of TPR minus FPR is a different summary; neither is the performance of a fixed deployment cut-off. At that cut-off, report TPR, FPR, precision and relevant costs; a ranked queue may call for AP or precision at its workload limit. Probability use also requires calibration assessment.
Add an interval. AUROC estimated on a few hundred positives moves several points between resamples, and quarterly validation reports routinely treat a movement of 0.01 as a trend.
Fairness parity criteria concern group relationships, which discrimination metrics alone do not establish.
References
- scikit-learn User Guide, Metrics and scoring
- Chouldechova, Fair prediction with disparate impact, 2017
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
