Financial Inclusion in Africa — Bank Account Prediction Pipeline

This competition is hosted on Zindi, a machine learning platform for data science challenges.

TL;DR: When you have few categorical features, the model's ceiling is determined by the feature engineer, not the algorithm. Domain-driven interactions and binning encode knowledge that would take a model thousands of splits to approximate from raw data.

The Problem

Financial inclusion is not just a data problem — it reflects real barriers to banking access in East Africa. The task was to predict whether an individual in Kenya, Rwanda, Tanzania, or Uganda has a bank account, given only demographic and socioeconomic features: age, gender, education, household size, job type, and cellphone access. On the surface, it looks like a straightforward binary classification. But the signal is subtle and deeply tied to geographic and cultural context.

A farmer in rural Tanzania faces different barriers than an urban professional in Nairobi. Education level means different things across countries. Household size interacts with income in ways that vary by region. The challenge wasn't building a model that memorizes patterns — it was building one that captures the structural differences in banking access across four very different economies.

The dataset had around 33,000 training records and 14,000 test records. The features were few (about 10), all categorical or ordinal. With so few columns, the key to performance was feature engineering — creating meaningful interactions that encode the domain knowledge a model cannot discover from raw categories alone.

My Approach

I started by asking: what does the data not say explicitly but implies structurally? A person's country combined with their location type (rural vs. urban) tells a different story than either alone. A young person in an urban area with cellphone access has a very different probability of having a bank account than an older person in a rural area without one. So I built interaction features: country crossed with location type, country crossed with gender, age bins crossed with education level.

For age, I created meaningful bins (20, 25, 30, 60, 80, 90) rather than treating it as continuous — because the relationship between age and banking is non-linear with distinct breakpoints. Household size became categorical: small (1 person), medium (2-5), large (5+). Job type was recoded into income source categories: formal employment, business, farming, dependent, and none. Each of these transformations encoded domain knowledge about how financial inclusion actually works in East Africa.

For feature selection, I ran Boruta for 100 iterations to separate truly informative features from noise. With only 10 original columns but many engineered interactions, it was crucial to identify which combinations actually carried predictive signal versus which just added noise. The confirmed features from Boruta, combined with Random Forest importance and feature-target correlations, formed the final feature set.

The final model was a 7-algorithm ensemble: Random Forest, Ranger, XGBoost, logistic regression, SVM, Naive Bayes, and GBM. Simple averaging of their predictions reduced variance and captured signal from fundamentally different model families — tree-based models captured interactions while linear models captured main effects cleanly.

Key Decisions

Geographic Interactions as First-Class Features

Country × location type and country × gender created features that encode structural differences in banking access across economies. A rural Tanzanian woman faces different barriers than an urban Kenyan man — the model needs features that let it learn these distinctions.

Boruta Feature Selection (100 Iterations)

With many engineered interactions from few original features, aggressive feature selection was essential to separate signal from noise. Boruta's shadow-variable approach confirmed which features carry genuine predictive power versus statistical artifacts.

Domain-Driven Binning Over Automatic Discretization

Age bins, household size categories, and income source recoding were designed from domain knowledge about financial inclusion patterns — not discovered by the model. This frontloads the structural understanding that a tree model would need thousands of splits to approximate.

Multi-Family Ensemble for Robustness

Combining tree models (Random Forest, XGBoost, GBM), kernel methods (SVM), linear models (logistic regression), and probabilistic models (Naive Bayes) ensures that different types of signal are captured. Simple averaging avoids overfitting the blend weights.

Key Takeaway

This project reinforced that when features are few and categorical, the modeling advantage comes entirely from feature engineering — specifically from encoding domain knowledge as interactions and meaningful bins. The raw features alone would give every model roughly the same ceiling. The geographic and demographic interactions I built gave the model access to structural patterns it could never discover from the original 10 columns alone. In classification problems with sparse categorical features, the feature engineer is the model.

Design insight: When you have few categorical features, the model's ceiling is determined by the feature engineer, not the algorithm. Domain-driven interactions and binning encode knowledge that would take a model thousands of splits to approximate from raw data.

FAQ

What is the key takeaway from "Financial Inclusion in Africa"?

When you have few categorical features, the model's ceiling is determined by the feature engineer, not the algorithm. Domain-driven interactions and binning encode knowledge that would take a model thousands of splits to approximate from raw data.

Who wrote this and what is it about?

This was written by Mahmoud Trigui, Senior Data Scientist. Predicting bank account ownership across Kenya, Rwanda, Tanzania, and Uganda using demographic and financial features. Ranked Top 13% (678/1288 competitors) on Zindi, August 2019.

Comments

Machine Learning Feature Engineering MLForecast Time Series Decomposition Forecasting LightGBM XGBoost Catboost Clustering Segmentation NLP LLMs Web App R Markdown SQL Oracle DB SAS-Guide SAS E-Miner Dataiku BigQuery GCP Python R CRISP-DM Hypothesis Testing ANOVA Data Analytics Dimensionality Reduction Recommendation System Network Analysis Geospace Analysis Spatial Data Embedding Sampling Techniques Decision Rules Data Storytelling CVM Churn Fraud Detection Sentiment Analysis Topic Modeling IBM Watson PowerBI Looker Studio VBA Statistical Learning Ensemble Modeling Stacking Cross-Validation Profiling ABT Construction Plumber Tidyverse Shiny Prophet Deep Learning Scikit-Learn JSON SAS Programming Git VS Code CSS Styling Automated Reporting Outlier Detection Temporal Clustering Startup Survival Pre-Valuation Modeling K-Means Decision Trees Data Science Predictive Modeling SVM LDA Text Classification Weight Prediction Pattern Recognition Real-Time Detection Community Detection Pipeline Automation Data Quality Checks Data Reliability Specification Mapping Business Strategy Marketing Campaigns Try & Buy Frameworks KPI Dashboards Network Quality Sales Analytics Mentoring Statistics Lecturer Remote Work Hybrid Work Consulting Contract Full-Time Freelance Sofrecom Orange Group Tunisia Telecom Kiota Intelligence VC Analytics Series A Prediction Production ML Applied AI Prompt Engineering Business Forecasting Decision Systems Graph Analytics Household Detection Multi-SIM Detection FTTH Forecasting Audit Extraction Infrastructure Classification Pydantic GPT-4 OpenAI API Base64 Classification Zindi Codementor LAAS-CNRS ESSAI MIT xPRO Tunisia ML Competition Cell Tower Analysis Uber Logistics Uber Cape Town Necessary Condition Analysis Behavioral Signals Spike Smoothing Observation Unit Design Dendrogram Ward Clustering VIF Target Encoding Machine Learning Feature Engineering MLForecast Time Series Decomposition Forecasting LightGBM XGBoost Catboost Clustering Segmentation NLP LLMs Web App R Markdown SQL Oracle DB SAS-Guide SAS E-Miner Dataiku BigQuery GCP Python R CRISP-DM Hypothesis Testing ANOVA Data Analytics Dimensionality Reduction Recommendation System Network Analysis Geospace Analysis Spatial Data Embedding Sampling Techniques Decision Rules Data Storytelling CVM Churn Fraud Detection Sentiment Analysis Topic Modeling IBM Watson PowerBI Looker Studio VBA Statistical Learning Ensemble Modeling Stacking Cross-Validation Profiling ABT Construction Plumber Tidyverse Shiny Prophet Deep Learning Scikit-Learn JSON SAS Programming Git VS Code CSS Styling Automated Reporting Outlier Detection Temporal Clustering Startup Survival Pre-Valuation Modeling K-Means Decision Trees Data Science Predictive Modeling SVM LDA Text Classification Weight Prediction Pattern Recognition Real-Time Detection Community Detection Pipeline Automation Data Quality Checks Data Reliability Specification Mapping Business Strategy Marketing Campaigns Try & Buy Frameworks KPI Dashboards Network Quality Sales Analytics Mentoring Statistics Lecturer Remote Work Hybrid Work Consulting Contract Full-Time Freelance Sofrecom Orange Group Tunisia Telecom Kiota Intelligence VC Analytics Series A Prediction Production ML Applied AI Prompt Engineering Business Forecasting Decision Systems Graph Analytics Household Detection Multi-SIM Detection FTTH Forecasting Audit Extraction Infrastructure Classification Pydantic GPT-4 OpenAI API Base64 Classification Zindi Codementor LAAS-CNRS ESSAI MIT xPRO Tunisia ML Competition Cell Tower Analysis Uber Logistics Uber Cape Town Necessary Condition Analysis Behavioral Signals Spike Smoothing Observation Unit Design Dendrogram Ward Clustering VIF Target Encoding