This project explores various Dimensionality Reduction and Manifold Learning algorithms using the classic Digits dataset from scikit-learn.
It demonstrates how high-dimensional data (64 features per image) can be visualized beautifully in 2D and 3D spaces using both linear and non-linear methods.
- PCA (Principal Component Analysis) – projects data on directions of maximum variance.
- LDA (Linear Discriminant Analysis) – supervised reduction maximizing class separability.
- ICA (Independent Component Analysis) – separates data into statistically independent components.
- Random Projection – fast, scalable projection preserving approximate distances.
- MDS (Multidimensional Scaling) – preserves pairwise distances to maintain geometric structure.
- Isomap – captures the global manifold structure using geodesic distances.
- LLE (Locally Linear Embedding) – preserves local neighborhood relationships.
- t-SNE (t-distributed Stochastic Neighbor Embedding) – great for cluster visualization; focuses on local relationships.
- UMAP (Uniform Manifold Approximation and Projection) – fast, structure-preserving, and scalable; combines local and global preservation.
- Data Loading – Digits dataset from scikit-learn.
- Preprocessing – Standardization for fair comparison across methods.
- Dimensionality Reduction – Apply all listed methods in both 2D and 3D.
- Visualization – Compare how each method represents the intrinsic geometry of data.
- Feature Engineering & Comparison – Explore how engineered features behave across methods.
UMAP provides a balance between speed, structure preservation, and visual clarity.
It maintains local clusters like t-SNE while also preserving broader relationships, making it perfect for visually meaningful embeddings.
Imagine uploading an image of a handwritten "7" and instantly retrieving similar "7"s from a huge dataset — that’s the real-world power of dimensionality reduction!
While exploring multiple Dimensionality Reduction techniques, I noticed a key insight: t-SNE and UMAP behaved very differently compared to traditional linear methods like PCA or LDA — and here’s why 👇
- Linear methods (PCA, LDA, ICA, Random Projection) mainly capture global variance — they find directions of maximum spread in data but may miss non-linear patterns.
- t-SNE (t-distributed Stochastic Neighbor Embedding) focuses on preserving local neighborhoods — it places similar points close together and separates dissimilar ones strongly. ** 🔍 Reason: t-SNE converts distances into probabilities, then minimizes the difference between high-dimensional and low-dimensional similarities, exaggerating cluster separation.
- UMAP (Uniform Manifold Approximation and Projection) balances local and global structure — it maintains both nearby relationships and broader topology. ** ⚙️ Reason: UMAP builds a graph of local connections and optimizes its low-dimensional embedding to preserve both fine-grained and large-scale structure efficiently.
✨ Result: t-SNE creates very distinct, tight clusters (great for visualization), while UMAP gives smoother, more meaningful global patterns — both revealing hidden structures that linear methods can’t show.
git clone https://github.com/<ASHMEET555>/dimensionality-reduction-visualization.git
cd dimensionality-reduction-visualization