machine learning model that predicts the probability of loan default.
# African Credit Scoring Challenge — Loan Default Prediction
**🏆 Rank: 10 / 78 | Public F1: 0.800 | Private F1: 0.775**
Zindi · July Study Jam Series ·20 July 2026 - 9 August 2026
---
## Overview
This repository contains the full solution for the Zindi African Credit Scoring Challenge, where the goal was to predict the likelihood of a customer defaulting on a loan using financial and macroeconomic data from Kenya and Ghana.
The core challenge beyond prediction accuracy was **cross-country generalisation**: models were trained exclusively on Kenyan data yet evaluated on both Kenyan and Ghanaian test records — requiring features and logic that hold across different financial markets.
Top-10 finishers were additionally required to submit a **credit scoring function** that translates model outputs into an interpretable 300–850 credit score.
---
## Results
| Split | F1 Score |
|---|---|
| Public leaderboard | 0.8000 |
| Private leaderboard | 0.7747 |
| Cross-validation (mean) | ~0.79 |
---
## Approach
### 1. Feature Engineering
- Date-derived features: loan term in days, disbursement/due weekday, month and year
- Financial ratios: repayment ratio, daily repayment amount
- Customer-level aggregates: mean and median `Total_Amount_to_Repay` per customer
- Log transforms on all monetary columns to reduce skew
- Outlier capping at the 90th percentile for `Total_Amount` and `Total_Amount_to_Repay`
- FRED macroeconomic indicators (inflation, exchange rate, interest rates, unemployment) as country-level context features
### 2. Handling Class Imbalance
- **BorderlineSMOTE** (`sampling_strategy=0.45`) applied inside each training fold only — generates synthetic minority samples near the decision boundary
- **`scale_pos_weight`** passed to each booster to further penalise false negatives
- **StratifiedKFold** (4 folds) to preserve the class ratio across every fold
### 3. Ensemble Model
A majority-vote ensemble of three gradient-boosted classif …