Lesson 6.3: Machine learning PD models against scorecards
Compare a gradient boosted model with a logistic scorecard on one dataset: AUC, overfitting, interactions, bad rate at a cut-off, explainability and cost.
By the end of this lesson you will be able to explain what a gradient boosted tree model is and how it differs from a logistic scorecard, compare the two on the same data using AUC, KS and the bad rate among approved applicants, find the kind of pattern that a machine learning model catches and an additive scorecard misses, add an interaction term to a scorecard to recover most of the gain, weigh the practical costs of machine learning in lending (explainability, stability, regulation, monitoring), put a rupee value on a small improvement in accuracy and choose a sensible role for machine learning in a credit team. You should have read Lessons 6.1 and 6.2, which built and scaled the logistic scorecard that serves as the benchmark here. The arithmetic is limited to rates and simple products, and the model results come from a calculation on the same synthetic data as before.
Machine learning has changed many fields, and credit is no exception. Lenders now test models such as gradient boosted trees, random forests and neural networks on application and behavioural data, and fintech lenders often start with them. The claim is that they find patterns that a simple scorecard misses and so predict default better. The claim is sometimes true, and often smaller than advertised. A credit analyst needs to be able to test it fairly, and to say honestly what is gained and what is paid for it.
What the two kinds of model do
A logistic scorecard is additive. The log odds of good are a sum of separate contributions, one for each characteristic. Each contribution depends only on the bin of that characteristic and not on the other answers. A short credit history costs the same number of points for every applicant, whatever else is true of them. The model is simple, stable and easy to explain.
A gradient boosted tree model builds many small decision trees one after another. A decision tree asks a series of yes or no questions about the inputs ("is utilisation above 60 per cent? then, is the credit history short?") and ends in a prediction at each leaf. A single small tree is weak. Boosting adds a new tree at each step that concentrates on the errors left by the trees before it, and the final prediction is the sum of all the trees, each scaled down by a small learning rate. Because each question in a tree depends on the answers to the questions above it, the model can capture interactions: effects that depend on a combination of inputs. It can also fit curves and steps in any shape.
In this lesson the boosted model is made of 150 trees of depth three, with a learning rate of 0.08, trained on the same five characteristics (taken as raw bin codes, so with no weights of evidence). Both models are trained on the same 7,000 development loans and judged on the same 3,000 holdout loans, which have 313 bad loans among them. The data are the synthetic sample described in Lesson 6.1.
The first comparison: ranking accuracy
The standard way to compare the models is with the AUC and the KS statistic on the holdout sample, which Module 7 explains in full. Here, higher is better.
Model · AUC on development · AUC on holdout · KS on holdoutUtilisation alone · – · 0.632 · –
Logistic scorecard, five characteristics · 0.724 · 0.692 · 0.285
Gradient boosted trees · 0.760 · 0.709 · 0.314
On the face of it, the boosted model wins: 0.709 against 0.692, and a KS of 0.314 against 0.285. Three cautions apply before any celebration.
1. The gain is small compared with the noise. With 313 bad loans and 2,687 good loans, the standard error of an AUC around 0.70 is about 0.017. A difference of 0.017 is about one standard error. In a real study you would compare the two models on the same loans with a paired test, which is more sensitive, and you would use more data. But a gap this size is not obviously real.
2. The boosted model overfits more. Its AUC falls from 0.760 on development to 0.709 on the holdout, a drop of 0.051, against 0.032 for the scorecard. A flexible model fits the quirks of the development sample as well as the real pattern. Choosing the number and depth of trees, and the learning rate, is a balance between fit and overfit, usually done by cross-validation.
3. AUC is only one summary. It measures how well the whole ranking separates good from bad, but a lender uses a model at a cut-off. Better ranking in the middle of the list is worth nothing if the decision is made at the extremes.
Predict first: a lender approves the 80 per cent of applicants with the best scores and declines the riskiest 20 per cent. Will the boosted model's higher AUC translate into a lower bad rate among the approved? Make a guess before reading on.
The second comparison: the bad rate that matters
Now look at what the lender actually experiences. Rank the 3,000 holdout applicants by each model's score, approve the safest share and count the bad loans among those approved.
Approval rate · Approved loans · Bad rate among approved, scorecard · Bad rate among approved, boosted model70% · 2,100 · 6.71% (141 bad) · 6.81% (143 bad)
80% · 2,400 · 7.46% (179 bad) · 7.54% (181 bad)
90% · 2,700 · 8.33% (225 bad) · 8.33% (225 bad)
The two models give almost identical results. At an 80 per cent approval rate, the scorecard approves 179 bad loans and the boosted model 181. In the riskiest tenth of applicants, both capture the same number of bad loans, 87 out of 313, or 27.8 per cent. The two lists of the riskiest 300 applicants overlap in 220 names, which is 73 per cent.
So the higher AUC did not turn into a lower bad rate at the cut-offs that the lender would use. This is a common finding in practice, and it should temper the claim that a better AUC means better business. The gain in AUC came from improved ranking in the middle of the score range, among applicants who would be approved or declined by either model. The decisions at the edges, which determine the bad rate, hardly changed.
With the defaults, the lender approves 24,000 loans a year and loses about 7.46 per cent of them to default: 1,790 bad loans. At ₹3 lakh a loan and 55 per cent loss given default, that is ₹2,954 lakh, about ₹29.5 crore of credit losses. A drop of 0.46 percentage points in the bad rate would save about ₹1.8 crore a year. That is real money, and it is also modest next to the cost of building, validating, monitoring and governing a more complex model. And in this test the actual improvement was zero.
Where did the extra AUC come from?
The boosted model has caught something, and it is worth finding out what, because the pattern might be used in a simpler way. The synthetic data were built with one hidden feature. A short credit history is harmful only for borrowers with high utilisation. Look at the bad rates.
· Credit history short · Credit history longUtilisation below 60% · 6.0% (110 bad of 1,824) · 6.8% (285 bad of 4,176)
Utilisation 60% and above · 27.9% (368 bad of 1,318) · 8.8% (237 bad of 2,682)
The scorecard of Lesson 6.1 treats a short history as a fixed penalty of about 25 points for everybody, averaging the two very different situations: no effect at low utilisation and a huge effect at high utilisation. It is additive and cannot represent the difference. The boosted model, through its trees, learns the combination directly. This is an interaction: the effect of one input depends on the level of another.
Giving the scorecard the same insight
If the pattern is known, you do not need a boosted model to use it. Add a single extra input to the logistic regression: a 0 or 1 flag that is 1 when utilisation is 60 per cent or more and the history is short. The result:
Model · AUC on development · AUC on holdout · KS on holdoutLogistic scorecard · 0.724 · 0.692 · 0.285
Scorecard plus the interaction flag · 0.740 · 0.707 · 0.303
Gradient boosted trees · 0.760 · 0.709 · 0.314
The interaction term gets the scorecard to a holdout AUC of 0.707, within 0.002 of the boosted model's 0.709, and the KS to 0.303 against 0.314. The coefficient on the flag is large and negative (−1.33 on the log odds of good), and the separate effect of a short history shrinks towards zero once the flag is in, which fits the story: history matters only for high-utilisation borrowers. The model remains a table of points, with one more row, and it is just as easy to explain.
This is the most useful practical lesson of the comparison. A machine learning model is often most valuable as a discovery tool. It reveals non-linear effects and interactions, which an analyst can then build into an interpretable model. Many lenders use a boosted model as a challenger: it runs alongside the scorecard, and when it finds a pattern the scorecard has missed, the scorecard is improved.
The practical costs of machine learning in credit
A model is not only an AUC. It has to be approved, documented, explained, monitored and trusted over years. The additional costs of flexible models in lending fall into six groups.
1. Explainability. A customer who is declined has a right, in many countries, to know the main reasons. A scorecard gives them from the points directly (Lesson 6.2). A boosted model with hundreds of trees has no such table. Methods exist that attribute a prediction to the inputs, and they give approximate explanations that need to be validated. They are more work and less transparent than points.
2. Stability. Credit models must keep working as the population changes. A flexible model that has fitted fine detail of the development period can be more sensitive to drift than a simple one. Its predictions can shift in surprising ways when an input changes slightly.
3. Monotonicity and business sense. A credit officer expects that more missed payments never make a borrower safer. A boosted model can produce small violations, such as a dip in risk for one range of utilisation, because of noise in the data. Many tools let the modeller impose monotonic constraints, so that the prediction can only rise or only fall as an input rises. Using them is good practice.
4. Regulation and model risk management. Banks and regulated lenders must validate their models independently and show that they are conceptually sound, well documented and monitored. Complex models require more validation effort. Regulators in many countries have said they will accept more complex models when they are explainable, tested and governed, and lenders must show that they have the skills to do so. The rules differ by country and change over time, so check the current requirements for the lender and the product.
5. Fairness. A flexible model can learn proxies for characteristics that the lender is not allowed to use, from many seemingly harmless inputs. It needs testing for disparate impact, and an explanation of why each input is used. A short, reviewed scorecard is easier to audit.
6. Operations. A boosted model needs code and infrastructure to run in production, version control, monitoring dashboards and a plan for retraining. A scorecard can be implemented as a lookup table in almost any system.
Where machine learning earns its place
The comparison here used five tidy characteristics and 10,000 loans. The balance changes in other settings, and machine learning has the clearest advantage in these:
Many inputs. With hundreds of candidate variables, such as bureau attributes or transaction summaries, automatic search for useful combinations is valuable.
Large data. Flexible models need many loans, and especially many bad loans, to find real patterns and not noise. A portfolio with a million loans supports models that 10,000 do not.
Unstructured or high-dimensional data. Bank statements, mobile phone usage, device data and text are hard to bin by hand. Models that work with raw patterns can extract signals.
Thin-file borrowers. Where little bureau history exists, a model that uses alternative data may do much better than a scorecard with few inputs. These are also the cases where fairness and explainability matter most.
Fraud and collections. Where the relationship is very non-linear and the cost of explainability is lower, such as in fraud detection, flexible models are the norm.
For the traditional personal loan with a handful of strong bureau characteristics, the gain over a well-built scorecard is often modest, as in this lesson.
A decision guide
When a lender asks whether to adopt a machine learning PD model, a sensible analyst works through questions like these.
1. Is the gain real? Compare on the same holdout with a paired test, preferably out of time, so that the holdout comes from a later period than development.
2. Is it large where it matters? Check the bad rate among approved at the actual cut-offs, and the capture in the riskiest deciles, not only the AUC.
3. Can the gain be had more simply? Look for interactions and non-linearities that can be added to a scorecard.
4. Is it worth the cost? Put the saving in rupees, as in the simulator, and compare it with the cost of governance.
5. Can it be explained and controlled? Check reason codes, monotonic constraints, stability and fairness.
6. What is the role? Options include the champion (the production model), the challenger (running alongside) or a component (for example, a boosted model produces a feature that goes into the scorecard).
In the case of this lesson, the answers are: the gain is small and within noise (1), it vanishes at the cut-offs (2), a single interaction term recovers it (3) and the saving would be small (4). The sensible decision is to keep the scorecard, add the interaction, and use the boosted model as a challenger. In another setting, with 200 variables and a million loans, the answers could be quite different.
Building the comparison in Python
A comparison like this uses standard libraries.
python
import numpy as np
import pandas as pd
from sklearn.ensemble import HistGradientBoostingClassifier
from sklearn.linearmodel import LogisticRegression
from sklearn.metrics import rocaucscore
dev = pd.readcsv("development.csv") # bin codes + WoE columns + bad flag
hold = pd.readcsv("holdout.csv")
woecols = ["utilwoe", "enqwoe", "homewoe", "incomewoe", "historywoe"]
rawcols = ["utilbin", "enqbin", "homebin", "incomebin", "historybin"]
the scorecard
lr = LogisticRegression(C=1e6, maxiter=1000).fit(dev[woecols], dev["bad"])
plr = lr.predictproba(hold[woecols])[:, 1]
the boosted model, with a limit on depth and a learning rate to control overfitting
gbm = HistGradientBoostingClassifier(maxdepth=3, learningrate=0.08, maxiter=150,
randomstate=0).fit(dev[rawcols], dev["bad"])
pgb = gbm.predictproba(hold[rawcols])[:, 1]
for name, p in [("scorecard", plr), ("boosted", pgb)]:
print(name, "holdout AUC", round(rocaucscore(hold["bad"], p), 3))
def badrateamongapproved(p, bad, share):
order = np.argsort(p) # safest first
keep = order[: int(len(p) share)]
return bad.iloc[keep].mean() 100
for share in (0.7, 0.8, 0.9):
print(share, round(badrateamongapproved(plr, hold["bad"], share), 2),
round(badrateamongapproved(pgb, hold["bad"], share), 2))
interaction term for the scorecard
dev["hishort"] = ((dev["utilbin"] >= 3) & (dev["historybin"] == 1)).astype(int)
hold["hishort"] = ((hold["utilbin"] >= 3) & (hold["historybin"] == 1)).astype(int)
lr2 = LogisticRegression(C=1e6, maxiter=1000).fit(dev[woecols + ["hishort"]], dev["bad"])
print("scorecard + interaction", round(rocaucscore(hold["bad"], lr2.predictproba(hold[woecols + ["hishort"]])[:, 1]), 3))
Note the choices that guard against overfitting: a small depth, a low learning rate and a limited number of rounds. In practice you would tune them with cross-validation on the development sample, and leave the holdout untouched until the end. Add monotonic constraints where the business logic demands them.
A worked example: reading a vendor's claim
A vendor tells a lender: "Our AI model improves AUC from 0.70 to 0.78, a gain of 11 per cent." How should the credit team respond?
1. Ask what the comparison was. Was the 0.70 a well-built scorecard on the same data, or a weak baseline? Was it computed on a holdout from a later period, or on the development sample?
2. Check the sample. How many bad loans were in the test? With 300 bads the standard error of the AUC is about 0.017, so a gain of 0.08 is meaningful, and a gain of 0.01 is not.
3. Ask for the business metrics. What is the bad rate among approved at the lender's approval rate, and how many more good customers could be approved at the same bad rate?
4. Ask what drives it. Which inputs? Are any of them unavailable at the time of decision (leakage), or sensitive?
5. Ask about explainability, stability and cost. Reason codes, monitoring and retraining, and the price.
6. Propose a test. Run the vendor model as a challenger on live applications for six months, and decide with real results.
A claim of "11 per cent better" is not a decision. It becomes one when it is turned into rupees at the lender's cut-off and tested out of time.
Common mistakes
Comparing only AUC. Check the bad rate among approved at the actual cut-off.
Comparing on the development sample. Flexible models always look better there.
Ignoring the noise. With few bad loans, small gaps are not reliable.
Using a weak baseline. Compare against a well-built, tuned scorecard, with interactions considered.
Skipping the search for interactions. A simple term may recover most of the gain.
Forgetting explainability and fairness. A model that cannot be explained or defended may not be usable.
Not constraining monotonicity. Noise can produce illogical risk patterns.
Treating machine learning as all or nothing. Use it as a challenger, a feature finder or a component.
Key takeaways
A scorecard is additive and simple. A gradient boosted model adds many small trees and can capture interactions and curves.
On the synthetic data the boosted model reached a holdout AUC of 0.709 against 0.692 for the scorecard, a gap of about one standard error, with more overfitting (a drop of 0.051 against 0.032).
At approval rates of 70, 80 and 90 per cent, the bad rate among approved was almost identical for the two models, so the AUC gain did not reach the decisions.
The gain came from an interaction: a short credit history mattered only at high utilisation (27.9 against 8.8 per cent bad, but 6.0 against 6.8 per cent at low utilisation).
One interaction term brought the scorecard to an AUC of 0.707, nearly the same as the boosted model.
Machine learning costs more in explainability, stability, validation, fairness and operations. It earns its place with many inputs, large data, unstructured data and thin files.
Use it as a challenger and a discovery tool first, and put the value in rupees before deciding.
Check yourself
1. What is an interaction, and why can an additive scorecard not capture one?
An interaction is an effect that depends on the level of another input. An additive scorecard gives each characteristic a fixed contribution regardless of the others, so it averages over the different situations.
2. Model A has a holdout AUC of 0.70 and model B 0.72, each on 200 bad loans. Why should you hesitate to declare B better?
With 200 bad loans the AUC has a standard error of about 0.02, so the gap is about one standard error. Compare on the same loans, use more data and check business metrics.
3. Both models approve 2,400 of 3,000 applicants, with 179 and 181 bad loans among them. What does this say?
Their bad rates among approved (7.46 and 7.54 per cent) are practically the same, so the better AUC of one model brought no improvement at this cut-off.
4. A boosted model has a development AUC of 0.85 and a holdout AUC of 0.70. What is the likely problem?
Overfitting. The model has fitted the quirks of the development sample. Reduce its complexity, tune with cross-validation and test again.
5. Name two situations in which a machine learning model is likely to beat a scorecard by a wide margin.
Many candidate inputs with a large sample, or unstructured data such as bank statement patterns. Thin-file borrowers with alternative data are another.
Try this
Compare a flexible model with a scorecard on data of your own. Set aside fifty to sixty minutes.
1. Take the WoE data and bad flag from Lesson 6.1, or invent a dataset of at least 5,000 loans with four or five characteristics. Include one interaction on purpose, where one input matters only at a high level of another.
2. Fit a logistic scorecard and a boosted tree model on 70 per cent of the data. Record the AUC on both samples for each. Write down the development-minus-holdout gap for each.
3. Compute the bad rate among the approved at approval rates of 70, 80 and 90 per cent for both models. Write down whether the gap in AUC shows up at the cut-offs.
4. Tabulate the bad rate by every pair of two characteristics and look for a pair where the effect of one depends on the other. Add that interaction to the scorecard and recompute the holdout AUC.
5. Use the simulator to value the best improvement in bad rate among the approved that you found, using made-up but realistic loan size and loss given default.
6. Write down three reasons a credit risk committee might object to the boosted model, and one way you could address each.
7. Write a five-sentence recommendation: which model you would run as the champion, what role the other would have, the evidence behind the choice, the rupee value and the check you would run before launch.
A good result is a table that shows both models side by side on AUC and on the bad rate at the cut-off, an interaction you found and used, a rupee value and a recommendation that a risk head could accept. Lesson 6.4 turns from the probability of default to the other two parts of expected loss: loss given default and exposure at default.
Tags: Credit Risk Analytics Machine Learning Gradient Boosting Scorecard Model Risk