📘 Regression Model Evaluation: Credit Limit Assignment
🎯 The Scenario
You're building an XGBoost regression model that predicts:
"How much credit can we safely give this loan applicant?"
Input: Application data, financial history, behavior data Output (y): A dollar amount (e.g., $10,000) — this is continuous, not a yes/no
Since we're predicting a number (not a class), we can't use AUC, KS, or accuracy. We need regression-specific metrics.
1️⃣ The Core Metrics: How to Measure "How Wrong" the Model Is
Think of these as different ways to ask: "How far off were our predictions?"
📊 The Five Key Metrics (Simplified)
Code
┌──────────────────────────────────────────────────────────────┐
│ │
│ Predicted: $8,000 Actual: $10,000 Error: -$2,000 │
│ │
│ Different metrics measure this gap differently: │
│ │
└──────────────────────────────────────────────────────────────┘
Metric
What It Tells You
Easy Example
RMSE
Punishes BIG mistakes more harshly
RMSE = $3,000 → occasional huge errors (like predicting $50K when answer is $10K)
MAE
Average error in dollars
MAE = $2,000 → typical prediction is $2K off
MAPE
Average error as a %
MAPE = 15% → predictions are typically 15% off
R²
% of variation the model explains
R² = 0.65 → model explains 65% of why limits differ
Spearman
How well rankings match (not exact $)
0.8 → applicants ranked high by model usually do get high limits
🔍 Quick Visual: RMSE vs MAE
Code
Actual limits: $10K, $10K, $10K, $10K
Predictions: $9K, $9K, $9K, $50K ← One big mistake!
MAE = average of |errors| = $11K (smoothed)
RMSE = sqrt(average of errors²) = $20K (BIG mistake stands out!)
→ Use RMSE when big errors are costly (like over-lending)
→ Use MAE when you want a fair average
💡 Why Each Metric Matters in Credit Context
Code
┌────────────────────────────────────────────────────────┐
│ │
│ RMSE → "Did we make any DISASTROUS predictions?" │
│ (Giving $50K to someone who can repay $10K) │
│ │
│ MAE → "What's our TYPICAL miss in dollars?" │
│ (Off by ~$2K on average) │
│ │
│ MAPE → "How proportional is our error?" │
│ ($1K miss on a $5K limit = bigger problem │
│ than $1K miss on a $50K limit) │
│ │
│ R² → "Is our model better than just guessing │
│ the average?" │
│ │
│ Spearman → "Do we at least rank people correctly?" │
│ (Even if dollars are slightly off) │
│ │
└────────────────────────────────────────────────────────┘
2️⃣ What's "Good Enough"? Industry Thresholds
These are typical benchmarks (varies by business, but useful guidelines):
Metric
Acceptable Range
Why It Matters
RMSE
≤ 15–25% of credit range
Prevents catastrophic over-lending
MAE
≤ 10–20% of credit range
Keeps typical errors within tolerance
MAPE
≤ 30–40%
Ensures fairness across small & large limits
R²
≥ 0.5 (≥ 0.4 for noisy data)
Model meaningfully explains differences
Spearman
≥ 0.6–0.7
Critical for ranking applicants into tiers
📌 Example Sanity Check
Code
Credit limits range from $0 to $50,000
✅ RMSE = $3,000 → 6% of range → GOOD
✅ MAE = $2,000 → 4% of range → GREAT
⚠️ MAPE = 35% → Borderline → OK
✅ R² = 0.65 → 65% explained → GOOD
✅ Spearman = 0.75 → Rankings solid → GOOD
Model status: APPROVED ✅
3️⃣ Why Rank Ordering Often Matters MORE Than Exact $$
Here's a crucial insight that surprises many people:
In credit risk, the EXACT predicted dollar amount usually gets adjusted by business rules anyway. What matters most is the RANKING — does the model correctly order applicants from low-risk to high-risk?
🎯 Visual Example
Code
┌──────────────────────────────────────────────────────────┐
│ │
│ Applicants and Model Predictions: │
│ │
│ Person A: Model predicts $8K, gets approved for $7K │
│ Person B: Model predicts $15K, gets approved for $14K │
│ Person C: Model predicts $25K, gets approved for $20K │
│ │
│ ✅ Exact $ may differ from approvals │
│ ✅ BUT the ORDER (A < B < C) is correct │
│ ✅ Business policy makes final $ adjustments │
│ │
│ → Spearman rank correlation captures this perfectly │
│ │
└──────────────────────────────────────────────────────────┘
Why This Matters for Regulators
Approval tiers (Tier 1, 2, 3) depend on relative ranking
Spearman correlation is often a regulatory requirement
A model with slightly worse RMSE but better Spearman is often preferred ✅
4️⃣ Stability Checks: Does the Model Hold Up Over Time?
Accuracy on test data isn't enough. You need to know:
"Will this model still work in 6 months when customer behavior shifts?"
Two Critical Stability Tests
🔄 PSI (Population Stability Index)
What it checks: Are your input features behaving similarly now vs when you trained?
Code
Training time: Today (6 months later):
Income distribution: Income distribution:
$30K-$50K: 40% $30K-$50K: 25% ← SHIFTED!
$50K-$80K: 40% $50K-$80K: 35%
$80K+: 20% $80K+: 40%
PSI = high → DANGER!
Population has changed → model may fail
PSI Score
Interpretation
< 0.10
✅ Stable — no action needed
0.10 – 0.25
⚠️ Slight shift — monitor
> 0.25
🚨 Major shift — retrain model
For regression: Apply PSI on binned features, not on the target value.
🎯 CSI (Characteristic Stability Index)
What it checks: Is the relationship between a feature and the target stable?
Code
Example: "Does income still predict credit limit the same way?"
Training: Income $50K → avg limit $15K
Today: Income $50K → avg limit $12K ← Relationship shifted!
For regression:
Bin the feature into groups
Calculate mean target per bin (training vs production)
No comments:
Post a Comment