Dimensionality Reduction: PCA, SVD, t-SNE, and UMAP Explained
High-dimensional datasets—from single-cell RNA sequencing matrices and hyperspectral satellite imagery to dense neural embeddings—frequently concentrate their meaningful signal along a much lower-dimensional intrinsic geometry. Dimensionality reduction algorithms compress thousands of correlated coordinates into compact representations for noise suppression, memory acceleration, decorrelated regression, and two-dimensional exploratory visualization.
Key Highlights
- Principal Component Analysis (PCA) computes orthogonal linear axes that capture maximum global variance via Singular Value Decomposition (SVD) of the centered data matrix.
- Linear methods (PCA, Truncated SVD) preserve global Euclidean proportions, support exact inverse reconstruction, and project unseen test rows deterministically.
- Non-linear neighbor-graph algorithms (t-SNE and UMAP) unfold curved manifolds by matching local neighborhood probabilities or fuzzy simplicial sets.
- Cluster sizes and empty gaps between islands in t-SNE/UMAP plots do not represent true metric distances—interpreting visual spacing literally is a common analytical error.
Linear Subspace Compression: PCA and Truncated SVD
Geometrically, PCA rotates the coordinate system so the first principal component aligns with the direction of greatest spread across centered observations, the second captures maximum remaining variance orthogonal to the first, and so forth. Numerically, modern libraries avoid forming the ill-conditioned covariance matrix XᵀX directly, computing thin or randomized Singular Value Decomposition X = UΣVᵀ for superior floating-point stability and linear scalability.
When inputs are massive sparse matrices—such as million-column term–document tables or user–item interactions—centering would destroy sparsity and overflow RAM; Truncated SVD operates directly on uncentered sparse matrices to produce Latent Semantic Indexing factors.
| Method | Geometry Preserved | Out-of-Sample Transform | Best Engineering Role |
|---|---|---|---|
| PCA / Randomized SVD | Global linear variance & pairwise distances | Exact fast matrix multiply X_new V_k | Noise filtering, collinearity removal, PCA pre-step before t-SNE |
| Truncated SVD | Uncentered sparse spectral rank-k approximation | Exact fast linear projection | Sparse text/click matrices without densifying zeros |
| t-SNE | Local pairwise Student-t neighborhood affinities | Requires retraining (or parametric variant) | 2D visual inspection of fine-grained local clusters |
| UMAP | Fuzzy topological local & mesoscale manifold graph | Supported via learned graph / parametric net | Fast large-scale visualization & pre-clustering manifold compression |
t-SNE and UMAP: Unfolding Curved Manifolds Safely
If points lie along a coiled Swiss-roll surface or hierarchical semantic tree, any flat linear shadow overlaps distinct branches on top of one another. Laurens van der Maaten and Geoffrey Hinton’s t-SNE converts high-dimensional Euclidean distances into Gaussian conditional probabilities and minimizes Kullback–Leibler divergence against a heavy-tailed Student-t distribution in two dimensions, alleviating the crowding problem.
Leland McInnes’s UMAP models high-dimensional neighborhoods via Riemannian fuzzy simplicial complexes and optimizes cross-entropy via stochastic gradient descent, running dramatically faster on hundreds of thousands of points while preserving broader mesoscale backbone relationships.
- Compress very wide inputs (for example, 20,000 genes) down to the top 50 PCA components first to strip high-frequency sensor noise before running UMAP or t-SNE.
- Sweep multiple n_neighbors / perplexity settings—small values emphasize micro-clusters, while larger values emphasize global topology.
- Never measure statistical significance on coordinates after UMAP/t-SNE using standard parametric p-values ("double dipping"), since the projection itself manufactured tight visual separation.
FAQs
How many Principal Components should I keep in PCA?
Inspect the cumulative explained-variance scree curve (commonly retaining 90%–95% of variance for compression), use parallel analysis / Gavish–Donoho optimal singular-value hard thresholding to separate signal from Gaussian noise, or tune k directly via downstream cross-validation.
Why does distance between two distant clusters in a t-SNE plot have little meaning?
t-SNE normalizes neighborhood widths locally around each point according to local density (controlled by perplexity) and penalizes local mismatches far more heavily than long-range distances, expanding dense clouds and shrinking sparse clouds visually.
References & Sources
- Jolliffe, Ian T.; Cadima, Jorge (2016) — Principal Component Analysis: A Review and Recent Developments, Philosophical Transactions of the Royal Society A.
- van der Maaten, Laurens; Hinton, Geoffrey (2008) — Visualizing Data using t-SNE, Journal of Machine Learning Research, 9, 2579–2605.
- McInnes, Leland; Healy, John; Melville, James (2018) — UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction, arXiv:1802.03426.