t-SNE intuitive infographic
Phase 4 ยท Algorithm 15 of 30

t-SNE

t-Distributed Stochastic Neighbor Embedding ยท Dimensionality Reduction & Visualization

๐Ÿ’กCore Concept

t-SNE takes high-dimensional data (think hundreds of features) and squeezes it into 2D or 3D so you can see it. Its one obsession: keep neighbors together. Points that are similar in high-D land close in the map; the global layout is sacrificed to preserve local structure faithfully.

๐ŸงฉKey Components

Pairwise Similarities

High-D closeness modeled as a Gaussian probability โ€” how likely point i picks j as a neighbor.

Student-t Kernel

Low-D uses a heavy-tailed t-distribution to relieve crowding and spread clusters apart.

Perplexity

The key knob (โ‰ˆ5โ€“50). Balances attention to local vs. broader neighborhoods.

KL Divergence

The loss. Gradient descent nudges the map until high-D and low-D similarities agree.

โš™๏ธHow It Works

  1. Compute pairwise similarities in high-D using Gaussian kernels (width set by perplexity).
  2. Randomly scatter points in the low-D map.
  3. Compute low-D similarities with the Student-t kernel (heavy tails).
  4. Measure the mismatch as KL divergence between the two similarity distributions.
  5. Move points via gradient descent to shrink that mismatch โ€” clusters emerge.
โš ๏ธ Read the map carefully: distances between clusters and cluster sizes are not reliable. t-SNE preserves who's near whom, not how far apart groups truly are.

๐ŸŒReal-World Applications

Single-cell RNA clusters Word / image embeddings MNIST digit maps Anomaly exploration Neural feature inspection

โœ…Checkpoint Questions

Why does t-SNE use a heavy-tailed t-distribution in the low-dimensional space instead of another Gaussian?
What does the perplexity parameter control, and what happens if you set it too low or too high?
Your t-SNE plot shows two clusters far apart. Why is it a mistake to conclude those groups are "very different"?