Logo Lanfrica

Sharif2138/Principle-Component-Analysis

Domain:

environment and energy
Creator:
Sha
Host:
This repository implements PCA concepts on a dataset about African crises Principal Component Analysis on CO₂ Emissions in Africa This project applies Principal Component Analysis (PCA) to a dataset about CO₂ emissions in African countries**. The goal is to reduce data dimensions while preserving as much variance (information) as possible. Data Preparation 1. Dataset Source: The data was downloaded from Kaggle. 2. Data Cleaning: - Removed null values. - Converted non-numeric columns to numeric format (since PCA only works with numbers). 3. Data Standardization: Standardized all numeric features using the formula: z = \frac{X - \text{mean}(X)}{\text{std}(X)} This ensures all features contribute equally to the PCA. PCA Implementation Steps performed in the notebook: 1. Computed the Covariance Matrix 2. Calculated Eigenvalues and Eigenvectors 3. Selected Principal Components dynamically based on explained variance 4. Projected the data onto these new components 5. Visualized the results using plots , one before PCA and another after PCA How to Run the Notebook 1. Clone this repository: 2.Navigate into the project folder: 3.Install the required dependencies: "pip install -r requirements.txt" Open the notebook: requirements.txt The requirements.txt file lists all Python packages needed to run the notebook. Example contents: pandas numpy matplotlib Output The notebook generates: A standardized dataset A reduced dataset with principal components Plots showing explained variance and PCA projections Author Sharif Kiviiri ALU Student | Data Science and ML Student 📧 s.kiviiri@alustudent.com