PCA only ever draws straight lines through your data — it can't bend to follow a curve. If two points are genuinely close in some high-dimensional, twisty sense but far apart along every straight axis, PCA has no way to notice. What kind of algorithm can?
Two true pairs, / and /, start jumbled together at random. After training, the pairs pull apart from each other and tighten internally — nothing here promises where each pair ends up, only that points that were neighbors stay neighbors.
t-SNE converts distances into probabilities in both spaces, then makes the low-dimensional probabilities match the high-dimensional ones as closely as possible.
- — how similar points are in the original high-dimensional space, from a Gaussian centered on each point.
- — how similar their images are in the low-dimensional embedding, from a heavier-tailed Student-t distribution.
- — the Gaussian's bandwidth (fixed here; real t-SNE solves for it per point to hit a target "perplexity").
- A heavier-tailed kernel in low dimensions, on purpose
Squeezing high-dimensional neighborhoods into 2D leaves less room for everyone — the Student-t kernel's heavy tails let moderately-distant points spread out further in the embedding without being punished, easing that crowding.
- Minimize how much Q disagrees with P
Gradient descent adjusts every embedded point to make track as closely as possible — the KL divergence between the two distributions is what's actually being minimized.
- Only local structure is preserved
Nothing in this objective cares about the absolute distance between two far-apart points, or which direction a cluster lands in — only whether true neighbors stay neighbors survives the compression.
Drag the steps slider. KL divergence doesn't fall smoothly — early on it can briefly get worse before the optimizer finds a better arrangement, the same way loss curves elsewhere in this course occasionally tick upward before a bigger drop. Given enough steps, it settles low and stays there.
Two tight pairs, – and –, twenty units apart from each other:
- Within-pair affinity
With , 's unnormalized Gaussian weights on , , are , , — the far points contribute nothing measurable. Normalizing: , and the same reasoning from 's side gives . Symmetrizing over points:
and symmetrically .
- Cross-pair affinity is essentially zero
, between the two far-apart pairs, comes out indistinguishable from — high-dimensional space has already declared these pairs unrelated.
- Training pulls each true pair together, blind to the original coordinates
Neither nor 's training process ever sees the numbers , , , or again once is computed — only the affinities. Yet gradient descent still finds an embedding where each pair ends up close and the two pairs end up apart, purely by matching to .
Drag the training-steps slider until KL divergence drops below 0.1.
t-SNE gives up everything PCA guarantees — no straight-line projection, no preserved absolute distances, no consistent orientation between runs — in exchange for one thing PCA can't do at all: following genuinely curved structure by preserving who's a neighbor of whom. That tradeoff is exactly why t-SNE plots are for looking, not measuring — the axes and distances between separated clusters carry no meaning, only the clustering itself does.