Logo Lanfrica

Aadeleye11/PCA-African-Development-Indicators

Domaine:

socioeconomic

Type de record:

dataset
Créateur:
Aad
Hôte:
# PCA on African Human Development Indicators Principal Component Analysis implemented **from scratch in NumPy** to reduce a real-world African development dataset from 9 dimensions to a compact set of principal components while retaining maximum variance. **Course:** Advanced Linear Algebra & Multivariate Probability — African Leadership University **Group members:** Bitega Sheja Dorian · Ayomide Shadrach Adeleye --- ## Dataset 54 African countries described by 9 numeric development indicators for **2021**, plus two non-numeric columns (`Country`, `Region`). **Source:** World Bank DataBank — World Development Indicators (WDI), 2021. | Indicator | WDI code | |---|---| | GDP per capita (current US$) | `NY.GDP.PCAP.CD` | | Life expectancy at birth (years) | `SP.DYN.LE00.IN` | | Infant mortality (per 1,000 live births) | `SP.DYN.IMRT.IN` | | Access to electricity (% of population) | `EG.ELC.ACCS.ZS` | | Water productivity (constant 2015 US$ / m³) | `ER.GDP.FWTL.M3.KD` | | Unemployment, total (% labour force, ILO) | `SL.UEM.TOTL.ZS` | | CO₂ emissions excl. LULUCF per capita (t CO₂e) | `EN.GHG.CO2.PC.CE.AR5` | | Population, total | `SP.POP.TOTL` | | Individuals using the Internet (%) | `IT.NET.USER.ZS` | The data carries **10 genuine missing values** (countries with no 2021 figure), handled by column-mean imputation. `Region` (5 groups) is excluded from the math and used only to colour the plots. The adult-literacy indicator was dropped because it was missing for ~70% of countries, which would have made imputation dominate the column. --- ## What the notebook does **Task 1 — PCA from scratch (NumPy only)** Mean-imputation → Z-score standardization → covariance matrix → eigendecomposition (`np.linalg.eigh`, for symmetric matrices) → sort components → project onto principal components. **Task 2 — Dynamic component selection** Scree and cumulative-variance plots, then the minimum number of components reaching a 95% variance threshold, chosen from the data. → **6 …