Nigeria's Carbon Crossroads: Predicting CO₂ Emissions with Machine Learning
# Nigeria's Carbon Crossroads: Predicting CO₂ Emissions with Machine Learning
## Motivation
Nigeria is urbanizing rapidly, its economy is growing, and energy demand is climbing. But what is actually driving its CO₂ emissions — and can socioeconomic indicators help us predict and understand future trajectories? This project applies the CRISP-DM data science process to three decades of World Bank data (1990–2023) to answer that question.
**Questions of Interest:**
- What factors drive Nigeria's CO₂ emissions the most?
- Can we accurately predict future emissions from socioeconomic indicators?
- How has rapid urbanization affected emissions over time?
- What would a green transition look like in measurable terms?
---
## Libraries Used
| Library | Purpose |
|---|---|
| `pandas` | Data loading, cleaning, and manipulation |
| `numpy` | Numerical operations and log transformation |
| `matplotlib` | Visualizations and plots |
| `scikit-learn` | Ridge Regression, cross-validation, scaling |
| `xgboost` | XGBoost model training and feature importance |
| `shap` | SHAP values for XGBoost model explainability |
---
## Repository Structure
| File | Description |
|---|---|
| `CO2_Emission_Prediction.ipynb` | Main Jupyter notebook with full analysis, comments, and visualizations |
| `Co2_data.xlsx` | Raw dataset (World Bank, 1990–2023) containing CO₂, GDP per capita, energy use, renewable share, industry %, urban population %, and population growth |
| `README.md` | This file |
---
## Summary of Results
### Exploratory Data Analysis
- CO₂ emissions nearly doubled from ~75 Mt in 1990 to ~126 Mt in 2023
- GDP per capita is heavily right-skewed and was log-transformed before modeling
- Industry's share of GDP *fell* from ~37% to ~18% over the period — a counterintuitive finding given rising emissions
- Renewable energy share and CO₂ showed the strongest correlation (r = −0.94)
- Year and Urban population were found to be perfectly collinear (r = 1.00); Year was dropped
# …