Dimensionality Reduction Cheat Sheet

PCA, t-SNE, UMAP — when to use each, explained variance, perplexity tuning, and practical dimensionality reduction strategies.

Last Updated: May 1, 2025

PCA (Principal Component Analysis)

ItemDescription
GoalFind orthogonal directions (principal components) that maximize variance
Math: Eigenvalues of Covariance MatrixTop-k eigenvectors = k principal components
Or: SVD of centered data matrixSingular vectors = principal components; singular values = sqrt(variance)
Explained Variance Ratiolambda_i / Sum(lambda_j) — proportion of variance captured by component i
Cumulative Explained VarianceSum of top-k variance ratios — how much information is retained
Choosing kElbow method, 95% variance threshold, or domain requirements
Standardize First!PCA is scale-sensitive — standardize to mean 0, variance 1 before PCA

t-SNE

ItemDescription
GoalVisualize high-dimensional data in 2D/3D — preserves local neighborhoods
How It WorksConverts high-D distances to probabilities; minimizes KL divergence in low-D
PerplexityBalances local vs global structure — typical range 5-50
Low Perplexity (5-15)Focus on very local structure — fine details, small clusters
High Perplexity (30-50)More global view — larger-scale patterns
IterationsNeeds 1,000+ — watch for convergence; early exaggeration for initial separation
Random Seed MattersDifferent seeds give different results — t-SNE is non-deterministic
LimitationsCannot interpret axis meanings; distances between clusters are meaningless

UMAP

ItemDescription
GoalFaster, more scalable t-SNE alternative — preserves global and local structure
Key Parameter: n_neighborsControls local vs global balance — similar to perplexity
min_distanceHow tightly points are packed — low=clumpy, high=spread out
Speed AdvantageMuch faster than t-SNE for large datasets (thousands to millions of points)
Deterministic (with fixed seed)Unlike t-SNE — reproducible results
General PurposeCan be used for feature reduction (not just visualization, unlike t-SNE)

When to Use Each

MethodBest ForSpeedInterpretabilityScale
PCALinear patterns, preprocessing, feature extractionFastHigh (components=linear combos)Any
t-SNEVisualizing clusters, local structureSlowLow (axes meaningless)<10K samples typical
UMAPVisualization + general reductionFastMediumScales to millions
Pro Tip: PCA excels at preserving global structure for linear relationships. t-SNE preserves local neighborhoods for visualization. UMAP balances both. Use PCA for preprocessing; t-SNE/UMAP for visualization.