An end-to-end machine learning project that develops an alternative credit scoring framework for Kenya's underserved population. Using engineered features inspired by M-Pesa, M-Shwari, employment, and housing data, the system predicts loan default risk and generates transparent credit scores with explainable reason codes.
# Alternative Credit Scoring — Kenya Context
Build a credit score using alternative financial signals (mobile money, savings, employment) instead of traditional credit history. Reach the 60% of Kenyans excluded from formal banking.
---
## The Problem
Kenya's credit gap is real. Traditional banks rely on Credit Reference Bureaus (TransUnion, Metropol, Creditinfo) that only capture formal credit history. This excludes 60% of the population - the unbanked majority who generate daily financial signals through M-Pesa, mobile savings products, utility payments, and informal income sources.
Result: millions of creditworthy people are denied access to credit.
---
## The Solution
This project demonstrates an alternative credit scoring pipeline using signals everyone generates:
- **Mobile money activity** (M-Pesa like transaction patterns)
- **Savings engagement** (M-Shwari like)
- **Employment stability** (job type and consistency)
- **Housing tenure** (rent, own, or free)
- **Loan purpose** (education, business, consumption, etc.)
Instead of a hand-weighted "composite score," the model learns how to weight these signals from historical data — 17 distinct features feeding into 5 different classifiers.
---
## What Works
**Best model:** Gradient Boosting
**AUC score:** 0.780 (test set) / 0.742 (5-fold cross-validation)
**Accuracy:** 76%
**Key finding:** Customers without a formal bank account actually default *less* often (10.3% vs 42.6%). The model picks up on this, approving 97.4% of this group with only 1.4% wrongful denial. This validates the core premise: lacking formal credit history is not inherently high-risk.
---
## How to Use
### Setup
```bash
pip install -r requirements.txt
```
### Run the Notebook
```bash
jupyter notebook Alternative_Credit_Scoring_Kenya.ipynb
```
The notebook walks through five phases:
1. **Phase 1:** Load raw German Credit Data (1,000 loan records)
2. **Phase 2:** Engineer 17 features reframed as Kenya alternative-data signa …