A model to predict data consumption in Africa
# Energy Consumption Prediction - CANSD 2024 Practice
This repository contains the machine learning pipeline developed for the 2024 Pan-African Data Science Competition (CANSD) organized by Data Afrique Hub, focusing on energy consumption prediction in Africa.
## Project Overview
Energy demand forecasting remains a critical challenge across African nations. This project demonstrates a complete machine learning workflow for predicting energy consumption using ensemble methods, developed as preparation for the national phase of the CANSD competition.
## Results Summary
### Model Performance
Trained on 150,000 samples (120,000 training, 30,000 validation) and tested on 62,500 samples:
| Model | Validation RMSE | Test RMSE | R² Score | Overfitting Gap |
|-------|----------------|-----------|----------|-----------------|
| **CatBoost** | **802.61** | **797.41** | **0.879** | **1.3%** ✓ |
| LightGBM | 803.59 | 798.61 | 0.879 | 2.5% ✓ |
| Ensemble | 803.01 | 797.83 | 0.879 | 16.4% ⚠️ |
| Random Forest | 809.29 | 803.92 | 0.877 | 172.2% ❌ |
**Winner: CatBoost** - Best test performance (797.41 RMSE) with minimal overfitting (1.3% gap).
### Key Findings
- **CatBoost** achieved the best balance of performance and generalization
- **LightGBM** showed excellent generalization with 2.5% overfitting gap
- **Ensemble** methods didn't significantly improve over the best single model
- **Random Forest** demonstrated severe overfitting despite reasonable test scores
## Background
In August 2025, after seeing the CANSD competition announcement on LinkedIn, I registered and decided to prepare by tackling the 2024 practice dataset. This preparation phase proved invaluable for understanding the nuances of applied machine learning that differ from theoretical frameworks.
A key insight came from reading an article by Mael Fotso, a 2024 participant who was eliminated at the national phase. His team used deep learning models and achieved an RMSE of 801.46, but the winning team u …