Skip to content

An implementation of Principal Component Analysis (PCA) for dimensionality reduction on the MNIST dataset. This project reduces the feature space and visualizes the impact of PCA on classification performance.

Notifications You must be signed in to change notification settings

fahadabid545/PCA-Implementation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 

Repository files navigation

🧠 PCA IMPLEMENTATION

This project demonstrates Principal Component Analysis (PCA) applied on the MNIST dataset to reduce dimensionality while preserving key features of handwritten digit images.


πŸ“ Dataset

The dataset used is the MNIST handwritten digits dataset, downloaded from Kaggle. It contains:

  • 60,000 training images
  • 10,000 test images
  • Each image is 28x28 pixels (784 features)

πŸ”§ Tools & Libraries

  • Python 🐍
  • NumPy & Pandas
  • Matplotlib & Seaborn (for visualization)
  • Scikit-Learn (for PCA and data preprocessing)

πŸ“Š Project Steps

  1. Data Loading & Preprocessing

    • Read the MNIST dataset
    • Normalize pixel values
    • Optional: Visualize a few digit samples
  2. PCA Application

    • Apply PCA to reduce from 784 dimensions to N components
    • Plot explained variance ratio vs. number of components
    • Reconstruct digits from reduced dimensions
  3. Visualization

    • Compare original and reconstructed images
    • 2D scatter plots of digits after PCA for clustering insight

πŸ“ˆ Results

  • PCA reduced dimensions while retaining ~95% variance with ~150 components
  • Reconstructed images were visually close to originals
  • 2D PCA plots showed visible clustering of different digits

πŸ’‘ Insights

  • PCA is effective for compression and visualization of high-dimensional data like MNIST.
  • You can balance between compression (fewer components) and reconstruction quality.

About

An implementation of Principal Component Analysis (PCA) for dimensionality reduction on the MNIST dataset. This project reduces the feature space and visualizes the impact of PCA on classification performance.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published