# π African Credit Scoring Challenge
## π Project Overview
This project focuses on building a robust, cross-country credit scoring model for the African market. The goal is to predict whether a borrower will default on a loan.
**The Challenge:**
- **Cross-Country Generalisation:** The model is trained on Kenyan data but must perform well in both Kenya and Ghana.
- **Extreme Imbalance:** Only ~1.8% of borrowers in the dataset defaulted. Predicting these rare cases is like finding a needle in a haystack.
- **Micro-Lending Nuance:** One loan can be co-funded by multiple lenders, creating complex relationships between borrower risk and lender exposure.
---
## π οΈ The Pipeline
### 1. Feature Engineering
Instead of just using raw numbers, we created features that capture the *intent* and *history* of the transaction:
* **Customer History:** We calculated the historical default rate for every customer. If they defaulted before, they are statistically more likely to do so again.
* **Loan Ratios:** We calculated the `repayment_ratio` (Total Repay / Total Amount). This serves as a proxy for the interest rate and "cost of capital" for the borrower.
* **Temporal Logic:** We extracted "Is Weekend," "Day of Year," and "Month End" flags. Financial stress often correlates with the time of the month (e.g., waiting for a paycheck).
* **Economic Enrichment:** We merged macro-economic data (Inflation, Exchange Rates, Unemployment) from the Federal Reserve (FRED) to help the model understand the broader financial climate of the country.
### 2. Modeling & Performance Analysis
To ensure maximum reliability, we conducted a "Model Tournament" using three distinct GBDT (Gradient Boosting Decision Tree) architectures. Each model brings a unique technical advantage to the credit scoring task:
#### π’ LightGBM
* **Why used:** Uses GOSS (Gradient-based One-Side Sampling) which focuses on instances with larger gradients. This is incredibly effective for finding the "Default" ca β¦