Library · Credit scoring

AUC and the Gini coefficient in credit scoring

The AUC is the probability that a randomly chosen defaulter has a worse score than a randomly chosen good payer. The Gini coefficient rescales it: Gini = 2 AUC − 1. Both measure ranking, and both depend on the population scored.

By , published

Definition

Take every pair made of one defaulter and one non-defaulter. The area under the ROC curve (AUC) is the share of pairs in which the model gives the defaulter the higher risk, ties counting for half. Hanley and McNeil showed this equivalence with the Mann-Whitney statistic.

Gini = 2 × AUC − 1

A model that ranks at random has an AUC of 0.5 and a Gini of 0. Credit risk teams also call the Gini the accuracy ratio. It says how well the model orders clients, and nothing about whether the predicted probabilities are right.

Worked example

A score is simulated for 6,000 applicants. The AUC is computed from the pairs and with scikit-learn, with a bootstrap interval. The same score is then evaluated on the better half of the applicants only, as if the worse half had been declined.

import numpy as np
from sklearn.metrics import roc_auc_score

rng = np.random.default_rng(20)
n = 6000
risk = rng.normal(size=n)
default = (rng.random(n) < 1 / (1 + np.exp(2.6 - 1.2 * risk))).astype(int)
score = risk + rng.normal(scale=0.8, size=n)            # higher = riskier

bad, good = score[default == 1], score[default == 0]
pairs = (bad[:, None] > good[None, :]).mean() + 0.5 * (bad[:, None] == good[None, :]).mean()
auc = roc_auc_score(default, score)
boot = [roc_auc_score(default[i], score[i]) for i in rng.integers(0, n, (1000, n))]
lo, hi = np.percentile(boot, [2.5, 97.5])
print(f"default rate = {default.mean():.3f}")
print(f"AUC from pairs = {pairs:.4f}   scikit-learn = {auc:.4f}")
print(f"AUC = {auc:.3f} [{lo:.3f}, {hi:.3f}]   Gini = {2 * auc - 1:.3f} [{2 * lo - 1:.3f}, {2 * hi - 1:.3f}]")

approved = score < np.median(score)                      # keep the better half
print(f"same score, approved half only: AUC = {roc_auc_score(default[approved], score[approved]):.3f}")

Output, produced by running the code above when this page was built:

default rate = 0.101
AUC from pairs = 0.7225   scikit-learn = 0.7225
AUC = 0.722 [0.702, 0.743]   Gini = 0.445 [0.403, 0.487]
same score, approved half only: AUC = 0.629

The interval on the Gini is twice as wide as the one on the AUC, in absolute terms. On the approved half the AUC is lower, although the model has not changed: the clients left are more alike, and harder to tell apart.

Where it misleads

  • A Gini cannot be compared across portfolios, products or periods with different mixes of clients. A fall in Gini after a tighter acceptance policy is expected and is not a deterioration of the model.
  • Ranking is unchanged by any increasing transformation of the score. A model can have an excellent Gini and predict default rates twice too high, which calibration checks.
  • With few defaults the interval is wide. A difference of two points of Gini between two models on a few hundred defaults is usually inside the noise; compare them with a paired interval.
  • The AUC weighs all score levels equally. A lender decides around one cut-off, and two models with the same AUC can differ there.

In our work

In our credit model validation report on 30,000 public credit card clients, the model reached an AUC of 0.794 on the sealed holdout, interval 0.783 to 0.805, which is a Gini of 0.588, interval 0.566 to 0.610.

References

  1. Hanley, J. A., McNeil, B. J. (1982). The meaning and use of the area under a receiver operating characteristic (ROC) curve. Radiology, 143(1), 29-36. doi:10.1148/radiology.143.1.7063747
  2. Lessmann, S., Baesens, B., Seow, H.-V., Thomas, L. C. (2015). Benchmarking state-of-the-art classification algorithms for credit scoring: an update of research. European Journal of Operational Research, 247(1), 124-136. doi:10.1016/j.ejor.2015.05.030
  3. Hand, D. J. (2009). Measuring classifier performance: a coherent alternative to the area under the ROC curve. Machine Learning, 77, 103-123. doi:10.1007/s10994-009-5119-5

Have a question like this one on your own data? Tell us what you need in a few lines.

Send us the brief

Related pages

  • The KS statistic of a scorecardThe Kolmogorov-Smirnov statistic of a scorecard is the maximum distance between two curves: the share of defaulters and the share of good payers below each score. It reads as the best separation achievable with one cut-off.
  • Probability calibration: slope and interceptCalibration asks whether predicted probabilities match observed frequencies. Two numbers summarise it: the intercept, for the overall level, and the slope, for the spread. A slope below 1 means predictions that are too extreme.
  • Paired comparison of two modelsTwo models tested on the same rows share most of their luck. Comparing their two confidence intervals ignores that. The interval of the difference, computed on the same resampled rows, is much narrower.
All library pages