t-SNE & UMAP
What are t-SNE and UMAP for?
Both are non-linear dimensionality reduction techniques used mainly to visualize high-dimensional data in 2D or 3D. They try to keep points that are neighbors in the original space close together in the plot, revealing cluster structure.
- “Are they used for modeling features?” — Mostly no — they're for exploration/visualization. UMAP is sometimes used for general reduction, but t-SNE rarely is.
How do they differ from PCA?
PCA is a linear method that preserves global variance directions; t-SNE/UMAP are non-linear and preserve local neighborhoods.
- Linear, deterministic, fast.
- Preserves global structure and variance; components are interpretable.
- Misses curved (manifold) structure.
- Non-linear; great at separating clusters visually.
- Preserve local neighborhoods, not global geometry.
- Stochastic and slower; axes are meaningless.
- “Common pipeline?” — Run PCA first (e.g. to 50 dims) to denoise and speed up, then t-SNE/UMAP for the 2D plot.
t-SNE vs UMAP — what's different?
UMAP is generally faster, scales better, and preserves more global structure, while t-SNE often gives crisp local clusters. UMAP can also transform new points; classic t-SNE can't.
- “Which would you pick?” — UMAP for large datasets and when you need to embed new data; t-SNE when you specifically want clean local cluster separation.
How do you read the plots without being misled?
These plots are easy to over-interpret. Three things are not reliable in a t-SNE/UMAP plot:
A dense blob may be expanded and a sparse one shrunk; area doesn't reflect count or spread.
Gaps between clusters don't encode how different they really are.
With bad settings, even random data can show fake clusters.
What's perplexity and why does it matter?
Perplexity (t-SNE) roughly sets how many neighbors each point balances — small values emphasize local structure, large values more global. UMAP's n_neighbors plays a similar role.
Try several perplexity / n_neighbors values and multiple seeds — if the structure is real, it should be stable across runs. Don't read causal meaning into a single plot.