Lesson 8.1: Model validation techniques and what they test
How independent validation works: design review, data checks, holdout, cross-validation, bootstrap ranges, benchmarking and a findings report.
By the end of this lesson you will be able to describe what an independent model validation covers, carry out the main statistical tests on a scorecard, interpret each result with its uncertainty, and turn the results into findings that a risk committee can act on. You will work through a holdout test with a bootstrap range, a five-fold cross-validation, a check of rank ordering, a leave-one-out sensitivity test, a benchmark comparison against a second model and an implementation test, all on the scorecard of Module 6. You should have read Modules 6 and 7, which built the scorecard and measured its ranking and calibration. The arithmetic is averages, differences and standard deviations, and every result comes from calculations on the synthetic dataset used throughout those modules.
A credit model decides who gets a loan, at what price and how much capital sits behind it. A model that is wrong is not just a technical failure. It misprices risk, rejects good customers or approves bad ones, and the damage can run for years before it is noticed. Lenders therefore treat the use of models as a risk in its own right, called model risk, and manage it with a discipline of independent review. This lesson and the three that follow cover that discipline: validation now, then stability, monitoring and governance.
What validation is
Model validation is an independent, structured assessment of whether a model is fit for the use it is put to. Three words in that sentence matter.
Independent. The people who validate a model are not the people who built it. Developers know what they intended and tend to see what they expected, so a second pair of eyes with no stake in the model is essential. In large banks this is a separate team reporting through a different line, in smaller lenders it may be an external firm or a senior analyst from another area.
Structured. Validation follows a plan that covers the same areas for every model, so that nothing is skipped and results can be compared.
Fit for use. A model is not simply good or bad. It is good enough, or not, for a stated purpose, such as setting an approval cut-off for personal loans up to ₹5 lakh, and is limited to that scope.
Validation happens at several points: before a model goes live, at regular intervals during its life (often yearly) and when it is changed or when monitoring shows trouble. The next lessons cover the monitoring that feeds it.
The components of a validation
A thorough validation reviews eight areas. They go from the reasoning behind the model to the way it is run.
Area · The question it asks1. Purpose and scope · What decision does the model support, and is it used only for that?
2. Conceptual soundness · Is the design sensible, and do the variables and signs make business sense?
3. Data · Are the data representative, complete, correctly defined and free of leakage?
4. Replication · Can the results be reproduced from the documentation and data?
5. Outcome analysis · How does the model perform on data it was not built on?
6. Benchmarking · Does it compare sensibly with alternatives?
7. Sensitivity and stress · How fragile is it to changes in inputs and conditions?
8. Implementation and governance · Does the production system do what the model says, and is the process controlled?
The rest of the lesson takes the areas in turn, using the scorecard and the data of Modules 6 and 7. Lessons 8.2 to 8.4 return to ongoing monitoring and documentation.
Conceptual soundness
Before running any test, the validator reads the design and asks whether it makes sense. For the scorecard, the five characteristics are utilisation, credit enquiries, home ownership, income band and credit history. A short review would note the following.
Signs and logic. All five coefficients are positive on weight of evidence inputs, so a safer bin always raises the score. That is as it should be.
Overlap. Utilisation and enquiries are correlated at 0.63, and their coefficients (0.53 and 0.70) are below the near-1 values of the independent variables. This is acceptable, but should be recorded and watched.
Treatment of credit history. The scorecard is additive, and credit history enters as a fixed penalty, but Lesson 6.3 found that a short history matters only at high utilisation. A validator will ask whether an additive form is adequate.
Use of income. The income variable is banded and stated by the applicant. A validator will ask how it is verified, since an unverified, self-reported variable can be manipulated.
Population. Is the model built on applicants like those it will score? A model built on one channel should not be used for another without evidence.
This review needs no calculation, only questions, and it often produces the most important findings.
Data
The validator checks that the development data are fit for purpose.
Definition of bad. Is it the same as the lender's policy (Lesson 1.4), applied consistently?
Sample. Does the window cover a full economic cycle, or only a good period? Are there exclusions, and are they justified?
Quality. Missing values, outliers, duplicates and coding errors. A summary of each variable before and after cleaning.
Leakage. Is any input known only after the decision? (Lesson 5.3.)
Representativeness. Do the development sample and the current applicants look alike? Lesson 8.2 gives a formal measure.
Reconciliation. Do counts of loans and bad loans match the lender's records?
Replication
A good test of a model's documentation is whether someone else can rebuild it. The validator takes the development data and the written method, refits the model and compares the result with the original. For the scorecard, the coefficients should agree to the third decimal place and the AUC to the fourth. If they do not, the documentation is incomplete or the code differs from the description, and either is a finding.
Outcome analysis: how does it perform on new data?
The central test is the performance on data that the model has not seen. This is where most of the statistics sit. Four techniques are used, and each adds something different.
The holdout test, with a range
The first is the holdout sample of Lesson 7.1: 3,000 loans, 313 bad. On it the scorecard's AUC, computed from the model's probabilities, is 0.692. But a single number from a finite sample is uncertain. A way of measuring that uncertainty without formulas is the bootstrap. Draw 3,000 loans from the holdout at random with replacement, so that some loans appear twice and some not at all. Compute the AUC. Repeat 1,000 times. The spread of the 1,000 AUC values shows how much the figure would vary from sample to sample.
For the scorecard, the standard deviation of the 1,000 values (the bootstrap standard error) is 0.016, and the middle 95 per cent of values runs from 0.659 to 0.726. A fair statement of the result is therefore: "the AUC on the holdout is 0.69, with a 95 per cent range of about 0.66 to 0.73." The width of that range, 0.07, is a direct consequence of having only 313 bad loans.
Cross-validation
A single split has an arbitrary element: a different random split would give a different holdout. Cross-validation removes this by using each part of the data in turn. In five-fold cross-validation, the 7,000 development loans are divided at random into five groups of 1,400. Each group in turn is held out while the model, including the weights of evidence, is rebuilt from the other four, then scored on the group held out. The result is five AUC values.
Fold · AUC · KS1 · 0.740 · 0.356
2 · 0.746 · 0.404
3 · 0.740 · 0.386
4 · 0.662 · 0.262
5 · 0.714 · 0.308
Mean · 0.720 · 0.343
Two lessons follow. The AUC varies from 0.662 to 0.746 depending on which 1,400 loans are held out, a standard deviation of 0.035. Anyone who judged the model on fold 4 alone would think it poor, and on fold 2 alone would think it good. The average across the folds is a more reliable estimate of the model's skill, 0.720. The cross-validation mean is higher than the holdout figure of 0.692, which has a range of 0.66 to 0.73, and the two are consistent within the noise. (The folds are drawn from the development sample, which has more good loans per bad one in some folds than others.)
Cross-validation also shows the stability of the coefficients. Across the five fits:
Term · Lowest · HighestIntercept · 2.18 · 2.27
Utilisation · 0.48 · 0.57
Enquiries · 0.67 · 0.73
Home ownership · 0.91 · 0.99
Income · 0.94 · 1.00
Credit history · 0.98 · 1.00
The coefficients stay within a narrow band, the widest being utilisation at 0.48 to 0.57. The model is stable: it does not depend heavily on which loans are in the training data.
Predict first: a validator finds that the AUC is 0.74 on the development sample, 0.72 in cross-validation and 0.69 on the holdout. Which of these should she quote as the model's expected performance on new applicants, and why? Think about each before reading on.
The holdout figure, or an out-of-time figure if one exists, is the most honest, because it comes from data that took no part in building or tuning. The development figure is optimistic since the model was fitted to it. The cross-validation mean is better than the development figure, but the weights of evidence and the choice of variables were made on the full development sample before the folds were cut, so it still leaks some information. In practice, a validator quotes the holdout figure with its range and shows the others as supporting evidence.
Out-of-time testing
A holdout drawn from the same period as the development data tests the model on borrowers who look like the development population. A more demanding test uses a later period, an out-of-time sample, which checks that the model survives a change of conditions. Lesson 7.5 showed what such a test can find: a cohort a year later in which the ranking held and the calibration failed. Where later data exist, it is the best single test of the model's resilience. Where they do not, a validator notes the limitation.
Rank ordering
A scorecard's bad rate should fall steadily as the score rises. The validator checks this on the holdout by cutting the loans into ten groups of 300 by score. The bad rates, from the riskiest group to the safest, are:
29.0%, 15.3%, 13.0%, 9.3%, 9.0%, 9.0%, 6.0%, 5.3%, 6.0%, 2.3%.
The pattern falls from 29.0 to 2.3 per cent with two small reversals: the seventh to ninth groups go 6.0, 5.3, 6.0. With 300 loans per group, the standard error of a bad rate near 6 per cent is about 1.4 points, so the reversal of 0.7 points is well within noise. The rank ordering passes, with a comment.
Benchmarking
A model should be compared with at least one alternative, to show that it is not obviously inferior. For the scorecard, the benchmark is the gradient boosted model of Lesson 6.3. On the holdout:
Scorecard AUC: 0.692 (bootstrap standard error 0.016).
Boosted model AUC: 0.709 (standard error 0.015).
Difference: 0.017.
The two AUCs are calculated on the same loans, so they are strongly related, and the right test uses a paired bootstrap: resample the loans, compute both AUCs on each resample and record the difference. The standard error of the difference is 0.008, much smaller than the standard errors of the separate AUCs, and the 95 per cent range is −0.0005 to +0.033. In 97.2 per cent of the resamples the boosted model is better.
The interpretation needs care. The difference is on the edge of significance: the range just includes zero. A validator would say that the benchmark suggests a modest advantage for the boosted model, which is not conclusive on this sample, and that the advantage is smaller still at the lender's approval cut-offs, as Lesson 6.3 showed. The scorecard is not obviously inferior, and the benchmark identifies a possible improvement to explore (the interaction between utilisation and history).
Sensitivity: what happens if something is removed?
A leave-one-out test removes each variable in turn, refits the model and measures the AUC on the holdout. It shows how much each variable contributes and exposes surprises.
Variable removed · Holdout AUC · Change from the full model (0.692)None (full model) · 0.692 · –
Utilisation · 0.692 · −0.0005
Credit enquiries · 0.670 · −0.022
Home ownership · 0.681 · −0.011
Income band · 0.675 · −0.017
Credit history · 0.700 · +0.007
Two results deserve a note in the report. First, utilisation can be removed with almost no loss, because it overlaps with enquiries. A validator might ask whether it is needed at all, and the developer's answer (it adds business logic and explanation value) would be recorded. Second, removing credit history improves the holdout AUC, by 0.007. This is the clue that credit history is not entering the model in a useful form, consistent with the interaction found in Lesson 6.3. A validator who saw this result would raise a finding.
A second type of sensitivity test shifts the inputs. If every applicant's utilisation moved one bin riskier, the average score would fall from 574.2 to 569.6 and the share approved at a cut-off of 570 would fall from 57.7 to 50.4 per cent. This shows the model reacting in the right direction and gives a measure of how much a shift in the population would move approval volumes.
Implementation testing
A model can be right on paper and wrong in the system that runs it. The validator takes a sample of loans, scores them through the production system and compares the results with the scores from the development code. Any difference is investigated. Common causes are a different treatment of missing values, bin edges applied with the wrong inclusive or exclusive boundary, rounding, outdated tables and fields that arrive in a different format. A scorecard with a 1 per cent mismatch rate in production has an error that is not in the model but in its use, and it will not show up in any statistical test of the development data.
Findings and conclusions
A validation report ends with findings: specific issues, each with a severity, a recommended action, an owner and a date. A scale such as high, medium and low is common. Based on the tests above, a validator might record the following.
# · Finding · Severity · Recommended action1 · Credit history is additive, though its effect depends on utilisation. Removing it improves holdout AUC. · Medium · Test an interaction term or a revised treatment, and report the effect
2 · The holdout has 313 bad loans, so the AUC range is wide (0.66 to 0.73) · Medium · Re-test when a larger out-of-time sample is available
3 · Utilisation and enquiries are correlated at 0.63, and removing utilisation costs almost nothing · Low · Document the reason for keeping both
4 · Decile 2 of the calibration table is amber (z of 2.7) · Low · Monitor in the next two quarters
5 · No out-of-time test has been performed · Medium · Run when 12 months of outcomes exist
The conclusion is not simply "pass" or "fail". It states the scope for which the model is approved, any conditions (such as completing findings 1 and 5 by a stated date) and the next review date. A common form is "approved for use for the personal loan product up to ₹5 lakh, subject to findings 1, 2 and 5 being closed within six months."
Running the tests in Python
The bootstrap, cross-validation and leave-one-out tests are short loops.
python
import numpy as np
import pandas as pd
from sklearn.metrics import rocaucscore
from sklearn.modelselection import StratifiedKFold
hold = pd.readcsv("holdout.csv") # columns: bad, pscorecard, pboosted
rng = np.random.defaultrng(1)
bootstrap range for the AUC, and paired bootstrap for the difference
n = len(hold)
aucs, diffs = [], []
for in range(1000):
idx = rng.integers(0, n, n)
s = hold.iloc[idx]
a1 = rocaucscore(s["bad"], s["pscorecard"])
a2 = rocaucscore(s["bad"], s["pboosted"])
aucs.append(a1)
diffs.append(a2 - a1)
print("AUC", round(np.mean(aucs), 3), "SE", round(np.std(aucs, ddof=1), 4),
"95% range", np.percentile(aucs, [2.5, 97.5]).round(3))
print("difference SE", round(np.std(diffs, ddof=1), 4), "share positive", np.mean(np.array(diffs) > 0))
five-fold cross-validation, rebuilding the weight of evidence inside each fold
dev = pd.readcsv("development.csv")
skf = StratifiedKFold(5, shuffle=True, randomstate=1)
for k, (tr, va) in enumerate(skf.split(dev, dev["bad"]), 1):
traink, valk = dev.iloc[tr], dev.iloc[va]
modelk, woek = fitscorecard(traink) # your own function from Module 6
auck = rocaucscore(valk["bad"], 1 - scorepd(modelk, woek, valk))
print("fold", k, round(auck, 3))
leave-one-out
for var in ["util", "enq", "home", "income", "history"]:
modelv, woev = fitscorecard(dev, drop=var)
aucv = rocaucscore(hold["bad"], 1 - scorepd(modelv, woev, hold))
print("without", var, round(aucv, 4))
The key discipline in the cross-validation loop is to rebuild everything that uses the outcome, the bins and the weights of evidence included, inside each fold. Computing the weights on the whole sample first and then cutting folds leaks information and flatters the result.
A worked example: reading a validation summary
A new validator joins and is given this summary of a scorecard: "Development AUC 0.80, holdout AUC 0.71, cross-validation mean 0.74, no out-of-time test." What would she conclude and ask?
1. The gap. From 0.80 to 0.71 is 0.09, large compared with the 0.03 seen for the scorecard in this lesson. It suggests overfitting, a difference between the samples or a leak in the development data.
2. The range. She asks how many bad loans were in the holdout. If it is about 300, the standard error is about 0.017, so the holdout range is roughly 0.68 to 0.74. If it is 60, the range is far wider.
3. The cross-validation. Were the weights of evidence and variable selection done inside each fold? If not, 0.74 is optimistic.
4. The missing test. No out-of-time check, so resilience to changing conditions is unknown. She sets this as a finding.
5. The benchmark. There is none. She asks for a simple comparator, such as a one-variable model or a boosted model.
6. The conclusion. She would approve the model for limited use with conditions: a larger or later holdout, a review of why the development AUC is so high and an out-of-time test within six months.
Nothing in the summary is wrong, but each number raises a question that needs answering before the model is relied on.
Common mistakes
Validating the model you built. Independence matters. Use someone else.
Quoting the development performance. It is optimistic. Use a holdout or out-of-time result.
Quoting a single number without a range. Give the bootstrap or analytical range.
Leaking information into cross-validation. Build bins and weights inside each fold.
Comparing two models with unpaired tests. Use the same loans and a paired test.
Ignoring surprises in the leave-one-out test. A variable whose removal improves the model is a finding.
Skipping implementation testing. Errors in the system do not show in the statistics.
Giving a pass or fail without scope and conditions. State what the model is approved for and what must be done.
Key takeaways
Validation is an independent, structured check of whether a model is fit for a stated use, before launch, at regular intervals and after changes.
It covers purpose, conceptual soundness, data, replication, outcome analysis, benchmarking, sensitivity and implementation.
A holdout AUC needs a range. The scorecard's 0.692 had a bootstrap standard error of 0.016 and a 95 per cent range of 0.66 to 0.73.
Five-fold cross-validation gave AUCs from 0.662 to 0.746 (mean 0.720, standard deviation 0.035), so a single split can mislead. The coefficients were stable across folds.
Benchmarking against a boosted model gave a difference of 0.017 with a paired standard error of 0.008 and a range of −0.0005 to +0.033, on the edge of significance.
Leave-one-out testing showed that enquiries mattered most, utilisation almost nothing and credit history negatively, a sign of poor treatment of that variable.
Findings carry a severity, an action, an owner and a date, and the conclusion states the scope and conditions of approval.
Check yourself
1. Why must a model be validated by someone other than its developer?
Developers tend to see what they expected and have a stake in the result. An independent reviewer challenges assumptions and finds problems the developer overlooks.
2. A bootstrap gives an AUC standard error of 0.02. What is the approximate 95 per cent range for an AUC of 0.70?
0.70 ± 1.96 × 0.02, about 0.66 to 0.74.
3. Why must weights of evidence be rebuilt inside each fold of a cross-validation?
Weights use the outcome, so computing them on all the data first lets information from the held-out fold leak into training and makes the result too good.
4. Removing one variable from a scorecard raises the holdout AUC. What might this mean?
The variable may be entering the model in a poor form, may be unstable or noisy, or may be redundant. It should be investigated.
5. The AUC difference between two models is 0.01 with a paired standard error of 0.01. What do you conclude?
The difference is one standard error, well within noise, so the data do not separate the models.
Try this
Validate a scorecard of your own. Set aside fifty to sixty minutes.
1. Take the development and holdout samples and the scorecard from Module 6, or build a small one on invented data with at least 5,000 loans and 5 variables.
2. Compute the holdout AUC and a bootstrap range with 500 or more resamples. Write the result as "AUC x, 95 per cent range y to z".
3. Run five-fold cross-validation, rebuilding the weights of evidence inside each fold. Record the five AUCs, their mean and their standard deviation, and the lowest and highest value of each coefficient.
4. Compute the bad rate by score decile on the holdout and check the rank ordering. Mark any reversal and judge whether it is within noise.
5. Do a leave-one-out test. Rank the variables by the loss in AUC when removed, and mark any whose removal improves the model.
6. Compare with a simple benchmark, such as a boosted model, with a paired bootstrap for the difference. Use the simulator to check the conclusion.
7. Write a validation note: three findings with severity and action, and a conclusion that states the scope, the conditions and the review date.
A good result is a holdout range, a cross-validation table, a sensitivity table, a paired benchmark and a note whose findings each follow from a number. Lesson 8.2 turns to the question that starts every monitoring programme: has the population the model sees changed?
Tags: Credit Risk Analytics Model Validation Cross-validation Bootstrap Model Risk