Loan Intelligence. XGBoost loan default prediction system for African microfinance markets, with a Streamlit dashboard for portfolio risk analysis, investment signals, and AI-powered querying via Claude API.
# 🏦 Loan Intelligence & Portfolio Optimization
### Predicting loan defaults and identifying high-return sectors in African microfinance markets
---
## What This Project Does
Most African microfinance borrowers have no formal credit history. This system solves three problems simultaneously:
1. **Default Risk** — Which borrowers are likely to default, and why?
2. **Capital Allocation** — Which sectors (agriculture, retail, services) deliver the best return on lending?
This project builds a full data science solution — from raw data ingestion to a live dashboard — that answers both questions using real-world loan data.
**Target Users:** Credit risk teams, loan officers, MFI portfolio managers
---
## Dashboard Pages
| Page | Business Question |
|---|---|
| Portfolio Overview | What is our overall portfolio health and model performance? |
| Investment Signals | Which sectors should we increase or reduce exposure to? |
| Portfolio Optimisation | Given our budget and risk philosophy, what is the optimal capital allocation? |
| Default Risk Map | Which African markets carry the most systemic risk? |
| Loan Predictor | What is the default risk on this specific loan application? |
Every page includes an **Ask AI** panel powered by the Anthropic Claude API for natural language querying of portfolio data.
---
## Architecture
```
Raw Data (3 sources)
│
â–Ľ
Bronze Layer ── bronze.db
(raw ingestion) kiva_loans_raw · worldbank_raw · lending_club_raw
│
â–Ľ
Silver Layer ── silver.db
(clean + join) lc_clean · kiva_clean · macro_clean · kiva_enriched
│
â–Ľ
Gold Layer ── gold.db
(ML-ready) lc_features · kiva_features · sector_performance
kiva_predictions · portfolio_allocations
│
â–Ľ
Dashboard ── Streamlit (5 pages)
```
---
## Key Technical Decisions
**Transfer learning** — Kiva's public dataset has no repayment outcomes. The model trains on Lending Club's verified labels and scores Kiva loans using shared features (loan amount, term, sector, repayment …