Financial Inclusion in Africa End-to-end ML project predicting financial access. Custom train_models pipeline evaluates Decision Tree, RF, Naive Bayes, XGBoost, LightGBM & CatBoost. Built domain interaction features & balanced class weights (auto_class_weights='Balanced'), doubling minority recall from 38.37% to 76.74% (F1: 0.515).
# 🌍 Financial Inclusion in Africa — Machine Learning Pipeline
An end-to-end machine learning project designed to predict individuals' access to bank accounts across East African countries. This repository covers data cleaning, exploratory analysis, domain-driven feature engineering, multi-model evaluation, and class imbalance optimization.
---
## 📌 Problem Overview & Goal
Financial inclusion is a critical driver for economic development. The objective of this project is to build a predictive model that identifies key demographic and socio-economic factors influencing whether an individual has or uses a formal bank account.
* **Dataset:** Demographic survey data containing variables such as age, location, education, job type, and technology access.
* **Target Variable:** `bank_account` (`1` = Has a bank account, `0` = Does not have a bank account).
* **Key Challenge:** Severe target class imbalance (~6:1 ratio in favor of `0`), requiring metric-focused optimization rather than relying on raw accuracy.
---
## 🛠️ Key Pipeline Features
1. **Modular Multi-Model Evaluator (`train_models`):**
* A custom, reusable Python evaluation function built around Scikit-Learn's API pattern.
* Fits, evaluates, and converts output reports into structured Pandas DataFrames for side-by-side comparison.
* Evaluates baseline algorithms: **Decision Tree**, **Random Forest**, **Gaussian Naive Bayes**, **XGBoost**, **LightGBM**, and **CatBoost**.
2. **Domain-Driven Feature Engineering:**
* Constructed targeted interaction features combining high-correlation predictors (e.g., combining Tertiary Education, Formal Government Employment, and Cellphone Access into a `premium_segment` indicator).
* Maintained clean experiment versioning by keeping baseline feature matrices (`X_train_base`) isolated from engineered matrices (`X_train_fe`).
3. **Class Imbalance Management:**
* Addressed minority class under-detection by tuning CatBoost's `auto_class_weights='Balanced'` hyperparameter.
* Succ …