AI-powered loan default prediction for a South African bank using H2O AutoML on 240K merged records, with a board-ready policy recommendation.
# AI-Powered Banking Intelligence: Loan Default Prediction
Predicting which bank customers are likely to default on a loan, before it happens, using automated machine learning on merged operational and customer data.
## Problem
A South African bank had no way of flagging likely loan defaulters in advance, only after the loss was already made. This project simulates an AI consultancy engagement: merge branch-level operations data with individual customer transaction data, build a predictive model, and turn the result into a policy recommendation a bank's board could actually act on.
## Approach
- Merged two 120,000-row datasets (branch operations and customer transactions) via branch-level aggregation, using Branch_ID as the join key
- Cleaned both datasets, dropping rows with missing values (~3% of rows) rather than imputing, to avoid introducing artificial values into the model
- Engineered a new feature, loan-to-income ratio, not present in either raw dataset, to capture affordability rather than raw loan size alone
- Trained and compared 17 machine learning models using H2O AutoML, with class balancing to correct for a 22% baseline default rate
- Evaluated the best model (a Stacked Ensemble) on accuracy, AUC, and feature importance
- Verified the risk driver was behavioral rather than geographic, default risk was nearly identical across provinces
## Key Finding
The best model achieved 77.9% accuracy and an AUC of 0.673, correctly flagging 71.5% of customers who went on to default, before they defaulted.
Loan-to-income ratio, the engineered feature, drove 44.7% of the model's predictions, more than credit score (20.4%) and raw loan amount (14.2%) combined. This means thoughtful feature engineering added more predictive power than any single raw column in the original data.
## Recommendation
Introduce a loan-to-income ratio threshold into the loan approval process, used to flag applications for mandatory human review, not to auto-reject. Pilot the threshold o …