Definition
For bin i of a variable, let gi be the share of all good payers that fall in the bin and bi the share of all bad payers.
WoEi = ln( gi ÷ bi ) IV = Σi ( gi − bi ) × WoEi
A positive WoE marks a bin with more good payers than average. Replacing each value by the WoE of its bin gives a logistic regression inputs on the scale of its output, which is why scorecards are built this way. Siddiqi gives the usual reading of IV: below 0.02 not predictive, 0.02 to 0.1 weak, 0.1 to 0.3 medium, above 0.3 strong, and above 0.5 worth checking for a leak.
Worked example
The information value is computed for a variable that carries a real signal and for a variable of pure noise, with 5, 10, 20 and 50 bins, on 2,000 clients of whom about 160 default.
import numpy as np
rng = np.random.default_rng(23)
n = 2000
x_real = rng.normal(size=n)
default = rng.random(n) < 1 / (1 + np.exp(2.6 - 0.6 * x_real))
x_noise = rng.normal(size=n)
def iv(x, bad, bins):
edges = np.quantile(x, np.linspace(0, 1, bins + 1))[1:-1]
k = np.searchsorted(edges, x)
g = np.bincount(k, weights=~bad, minlength=bins) / (~bad).sum()
b = np.bincount(k, weights=bad, minlength=bins) / bad.sum()
g, b = np.clip(g, 1e-4, None), np.clip(b, 1e-4, None)
return np.sum((g - b) * np.log(g / b))
print(f"defaults: {default.sum()} of {n}")
print("bins IV real variable IV noise variable expected IV of noise")
for bins in (5, 10, 20, 50):
expected = (bins - 1) * (1 / default.sum() + 1 / (~default).sum())
print(f"{bins:4d} {iv(x_real, default, bins):18.3f} {iv(x_noise, default, bins):19.3f} {expected:22.3f}")Output, produced by running the code above when this page was built:
defaults: 153 of 2000 bins IV real variable IV noise variable expected IV of noise 5 0.146 0.009 0.028 10 0.194 0.026 0.064 20 0.236 0.121 0.134 50 0.881 0.282 0.347
The noise variable has a positive information value that grows with the number of bins, and crosses the 0.02 and 0.1 marks without containing anything. The real variable also gains from finer bins, and part of that gain is the same artefact.
Where it misleads
- IV is always positive, and its expected value for a useless variable is about (B − 1) times (1/goods + 1/bads). With few defaults and many bins, every variable looks at least weak.
- Bins chosen to maximise IV on the development sample overfit. The WoE of a bin with a handful of defaults is mostly noise and will not hold on new data.
- Selecting variables by IV on the full sample, then validating by cross-validation, is a leak: the selection has seen the validation rows.
- A bin without defaults has an infinite WoE. The smoothing constant used to avoid it changes the IV, and should be stated.
The formula is the population stability index between the distribution of goods and that of bads, which is why both share the same small-sample behaviour.
In our work
When we build or review a scorecard, binning and variable selection sit inside the validation loop, and each IV is compared with the value a noise variable would reach with the same bins and the same number of defaults.
Service: machine learning and model validation Research note: credit model validation, a worked report
References
- Siddiqi, N. (2005). Credit risk scorecards: developing and implementing intelligent credit scoring. Wiley, Hoboken.
- Thomas, L. C., Edelman, D. B., Crook, J. N. (2002). Credit scoring and its applications. SIAM, Philadelphia. doi:10.1137/1.9780898718317
- Yurdakul, B., Naranjo, J. (2020). Statistical properties of the population stability index. Journal of Risk Model Validation, 14(4), 89-100. doi:10.21314/JRMV.2020.227