freecoding.school100% FREE · NO SIGNUP
Tensor TownISSUE #11 of 120

dimensionality reduction · pca · t-sne · umap

NeuraVSThe Overfit Ogre
Neura saysDimensionality reduction (PCA, t-SNE, UMAP) compresses many features into a few.

High-dimensional data is hard to model and visualize. PCA finds the directions of greatest variance and projects onto them (linear, fast, great for preprocessing). t-SNE and UMAP are nonlinear, made for visualizing clusters in 2D/3D — but their distances/sizes can mislead. Use PCA to reduce features for models; t-SNE/UMAP to look at structure, not to measure it.

Power-ups you unlock

The Overfit Ogre attacks — common mistakes

Boss battleChoose PCA vs t-SNE for: feeding a model vs eyeballing clusters.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>reduce features for a model → PCA
visualize clusters in 2D     → t-SNE / UMAP
(don’t trust t-SNE distances)</pre></body></html>
▶ Open the interactive comic issue
‹ Clustering · K-Means · DbscanLinear Regression · The Simplest Model ›