Skip to content

t-SNE and UMAP

Methods that squash high-dimensional data into a 2D picture while keeping similar points close together, great for spotting clusters.

Also t-SNE · UMAP · nonlinear dimensionality reduction · embedding visualization

Fig. / How it works
SIMILAR ITEMS END UP CLOSE TOGETHER
Role · kind
Models and algorithmsTechnique
Level
Intermediate

van der Maaten and Hinton (t-SNE), 2008; McInnes, Healy and Melville (UMAP), 2018

Seating a big wedding party at tables in a small room: friends should sit together, even if the room cannot keep every distance exactly right.

Where it fits

+All relationships as a list

See it on the full map

How it works

PCA flattens data with a straight projection, which can pile distinct groups on top of each other. t-SNE and UMAP instead bend and stretch freely, with one goal: points that are neighbors in the original high-dimensional space should be neighbors in the 2D picture.

  • t-SNE (2008) turns distances into “who is likely a neighbor of whom” probabilities, then arranges 2D points so those probabilities match.
  • UMAP (2018) builds a graph of nearest neighbors and lays it out in 2D; it is faster and tends to keep a little more of the large-scale structure.

They are wonderful for exploring embeddings: clusters of similar words, image types or cell types pop out as islands. But read the plots carefully. Cluster sizes, gaps between clusters and positions of islands relative to each other often carry little meaning, and different settings can tell different stories. Use them to form hypotheses, then test those hypotheses another way.

Everyday use cases

  • Case 01

    Exploring embeddings

    Plot word or image embeddings to see which items group together.

  • Case 02

    Single-cell biology

    Cell types appear as islands in UMAP plots of gene-expression data.

Strengths, weaknesses and when to use it

Strengths

  • Reveals cluster structure that linear methods like PCA flatten.

Weaknesses

  • Distances between clusters and cluster sizes are often meaningless.
  • Results change with settings (perplexity, number of neighbors) and random seeds.

When to use itFor visual exploration only; do not draw quantitative conclusions from the picture.

Compare with

Check yourself

  1. Q01

    In a t-SNE plot, can you trust the distance between two far-apart clusters?

    Show answer

    A: Not really; t-SNE mainly preserves local neighborhoods

Go deeper