Zindi competition to predict financial health (Low/Medium/High) for small and medium-sized businesses in Southern Africa.
---
# Financial Health Index Prediction
A machine learning pipeline to predict financial health (Low/Medium/High) for small and medium-sized businesses in Southern Africa. This Zindi competition project uses gradient boosting to classify 9,600+ SMEs based on their business metrics, financial behaviors, and operational characteristics.
**Dataset**: 9,618 training records × 39 features | 2,405 test records
**Target**: 3-class classification (Low: 65%, Medium: 30%, High: 5% — severe imbalance)
**Best Model**: Gradient Boosting (F1: 0.82, Accuracy: 78.7%)
**Status**: ✅ Production-ready with API deployment
---
## Executive Summary
**Key Finding**: Financial metrics drive health classification, NOT demographics.
- **Top Predictor**: Business Turnover (18% importance)
- **Second**: Personal Income (15%)
- **Third**: Business Expenses (12%)
- **Critical Insight**: Financial metrics account for 75% of predictive power. Business size and profitability dominate health assessment.
---
## Quick Start
### 1. Setup Environment
```bash
source venv/bin/activate
pip install -r requirements.txt
```
### 2. Run Full Pipeline
```bash
# Phase 1: Exploratory Data Analysis
jupyter notebook eda/eda.ipynb
# Phase 2: Data Cleaning
python cleaning/clean.py
# Phase 3: Model Training
python modeling/train.py
# Phase 4: Generate Test Predictions
python modeling/predict.py
# Output: test_predictions.csv
```
---
## Project Structure
```
Financial_health_index/
├── README.md # This file
├── requirements.txt # Python dependencies
│
├── data/
│ ├── Train.csv # 9,618 records × 39 features + Target
│ ├── Test.csv # 2,405 records × 38 features
│ ├── VariableDefinitions.csv # Feature metadata & descriptions
│ └── cleaned/ # Cleaned data outputs (generated)
│
├── eda/
│ └── eda.ipynb # 8-section exploratory analysis
│
├── cleaning/
│ ├── __init__.py
│ └── clean.py …