Predicting M-Shwari mobile credit uptake in Kenya using XGBoost and SHAP — with fairness analysis across gender, wealth, and age.
# M-Shwari-project
Predicting M-Shwari mobile credit uptake in Kenya using XGBoost and SHAP — with fairness analysis across gender, wealth, and age.
# M-Shwari Credit Scoring — Kenya FinAccess 2016
This project builds a machine learning pipeline to predict uptake of
M-Shwari mobile banking credit among Kenyan households, using the FSD
Kenya FinAccess 2016 national survey (8,665 respondents).
The analysis is motivated by Bharadwaj, Jack & Suri (2019), which showed
that M-Shwari loans improve household resilience to financial shocks, but
treated the underlying credit-scoring algorithm as a black box. This project
opens that black box — identifying which observable household and behavioral
characteristics best predict who takes up this kind of mobile credit.
## Key Findings
- XGBoost model achieves AUC = 0.95 on a held-out test set
- Mobile banking usage is the single strongest predictor by a wide margin
(SHAP = 6.57), followed by formal savings status and household wealth index
- Fairness analysis reveals the model performs better for women than men,
best for the poorest wealth quintile, and fails entirely for respondents
over 60 due to data sparsity
## Pipeline
- Data loading from SPSS (.sav) format via pyreadstat
- Feature engineering: 20 features across demographics, wealth,
digital access, credit behavior, and savings behavior
- Class imbalance handled with SMOTE (4.9% positive rate)
- XGBoost classifier with threshold tuning (optimized at 0.10 for recall)
- SHAP TreeExplainer for interpretability
- Subgroup fairness analysis across gender, wealth quintile, and age group
## Dataset
FSD Kenya FinAccess 2016 — available at fsdkenya.org
## Reference
Bharadwaj, P., Jack, W., & Suri, T. (2019). Fintech and Household
Resilience to Shocks: Evidence from Digital Loans in Kenya.
NBER Working Paper No. 25604.