Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
← Machine Learning for Finnace & Accounting Level Three Β· Lesson 4 of 10

Mofdule Three

πŸ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
4
Module 3: Credit Risk Scoring & Probability of Default for Young Coders
⭐ Module 3 · Level Three

Credit Risk Scoring
& Probability of Default

πŸ’³ How do banks guess who might not pay back?

🎯 What you'll learn in this module

  • βœ” What PD, LGD, and EAD mean β€” the three numbers behind every loan
  • βœ” How logistic regression builds credit scorecards
  • βœ” How gradient boosting improves risk models
  • βœ” How to handle imbalanced default datasets
  • βœ” The basics of Basel‑compliant model validation
  • βœ” What reject inference is and why it matters
🏦
What Is Credit Risk?
The Big Idea

Credit risk is the chance that a borrower won't pay back their loan. If you lend your friend $20 and they never pay you back, you've experienced credit risk.

Banks face this every day. They lend money to millions of people and businesses. To survive, they must carefully estimate who's likely to repay and who's likely to default β€” before they hand over the money. Machine learning helps them do exactly that.

🀝 Lending money is a calculated gamble. Credit risk scoring is how banks tilt the odds in their favour.
πŸ“Š
PD, LGD & EAD: The Three Numbers
Fundamentals

Every credit risk model boils down to three questions:

Term Question Example
PD β€” Probability of Default How likely is this borrower to default? 5% chance
LGD β€” Loss Given Default If they default, how much will I lose? 60% of the loan
EAD β€” Exposure at Default How much money is at risk at the moment of default? $10,000

Multiply them together: expected loss = PD Γ— LGD Γ— EAD. That's the money a bank expects to lose on average. Our ML models here focus mainly on PD.

🎲 PD = how often you roll a 1. LGD = how bad losing is when you roll a 1. EAD = how much money is riding on each roll.
πŸ“‹
Logistic Regression & Scorecards
Classical

For decades, banks built credit scores with logistic regression β€” a classic ML model that outputs a probability between 0 and 1. Perfect for "what's the chance of default?"

Logistic regression becomes a scorecard: each borrower gets points for their income, credit history, age, etc. The higher the score, the lower the risk. These scorecards are transparent, explainable, and often required by regulators.

🎯 A credit scorecard is like a rubric for a school assignment. Every criterion earns points. Add up the points β€” that's the final grade (the credit score).
🌲
Gradient Boosting: Stronger Risk Models
ML Models

Gradient boosting (XGBoost, LightGBM) often outperforms logistic regression on real credit data. It automatically captures interactions and non‑linear patterns that a simple scorecard misses.

The trade‑off? It's less transparent. Banks use it carefully, often with SHAP explanations to justify individual decisions (explaining why someone got rejected is legally required in many countries).

πŸ” Logistic regression tells you exactly which rules were applied. Boosting applies hundreds of tiny rules β€” powerful, but harder to explain without a good magnifying glass (SHAP).
βš–οΈ
Imbalanced Data: Most People Pay Back
Data Challenge

Here's the challenge: most people pay back their loans! Defaults might be only 2–5% of your data. If you train a model on that, it could just say "everyone will pay back" and be 95% accurate β€” but useless.

Solutions: class weighting, oversampling the minority class (SMOTE), undersampling the majority, and evaluating with metrics designed for imbalance β€” like recall, AUC, and precision instead of plain accuracy.

🎯 Imagine 100 darts in a board, but only 2 are red and 98 are blue. If you always guess "blue," you're right 98% of the time β€” but you never find the red ones.
πŸ“œ
Basel‑Compliant Model Validation
Governance

Banks can't just build a model and use it. Regulators under Basel II / III require strict validation. The model must be tested on out‑of‑time data, not just out‑of‑sample data.

Validation checks include: discrimination (does the model rank risky borrowers lower?), calibration (does 5% predicted PD really mean 5% defaults in real life?), stability (has the model drifted?), and documentation (can a regulator understand it?). Model risk is real risk.

πŸ›‚ Model validation is like airport security for banks: every model must pass through a set of checks before being allowed to fly (i.e., go live).
🎭
Reject Inference: The Missing Data Problem
Advanced

Here's a sneaky problem: banks only lend to people they already approved. So they only have repayment data for people they accepted. What about the people they rejected? They might have been great payers β€” but they never got the chance!

Reject inference is a family of techniques to estimate what would have happened to the rejected applicants. Without it, your model keeps making the same mistakes as the old model. It's a fascinating example of how data reflects decisions, not just reality.

πŸšͺ You only know the skills of the people you let into the club. Who knows how good the ones you turned away might have been?
🟒 Low Risk Β· 0–2% PD
↓
🟑 Medium Risk Β· 2–10% PD
↓
πŸ”΄ High Risk Β· 10%+ PD
⚠️ Fairness alert: Credit models can accidentally discriminate against groups if trained on biased historical data. A model might learn "people from neighborhood X default more often" β€” and repeat a historical injustice. Responsible ML means auditing for bias and ensuring fairness across groups.

πŸ› οΈ Hands-on activities (no boring stuff!)

1

Design a mini scorecard: Imagine five features (income, age, existing debt, employment years, previous defaults). Give each feature a point value. Score three imaginary applicants. Which one would you lend to?

2

Expected loss calculation: A borrower has PD = 4%, LGD = 50%, EAD = $10,000. Calculate expected loss. Then double the PD β€” how much does expected loss change? Notice how sensitive it is.

3

Imbalance experiment: Imagine a dataset of 1,000 borrowers where 950 repay and 50 default. A lazy model predicts "everyone repays" β€” what's its accuracy? What's its recall on defaults? Explain why accuracy is misleading here.

4

Scorecard walkthrough: Write out the logic of a simple scoring rule in plain English: "If income > $50k AND age > 25 AND no defaults, score += 20." Add 4 more rules. Then try scoring three imaginary applicants by hand.

5

Fairness check: Imagine your model rejects 40% of applicants from Group A but only 15% from Group B. Is that fair? Write one sentence about why historical data might create this pattern and what you'd investigate.

6

Reject inference puzzle: A bank rejected 100 people. Later, a competitor lends them money β€” and 90 pay back fine. What does this tell you about the bank's original model? Write a two-sentence explanation.

πŸ†

By the end of this module, you'll be able to: explain PD, LGD, and EAD, build a basic credit scorecard, handle imbalanced default data, recognize the need for model validation, and think critically about fairness and reject inference.

πŸ† Get Certified

πŸ”’

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (₦2,000 or 20,000 coins), and get a verified certificate with your name on it.

πŸŽ“ Sign Up to Get Certified
πŸ› οΈ Practice Tools
Hands-on simulators & labs - subscription required.
β†’
🎯 Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
β†’