Sub topic 8
The Student-t kernel and the crowding problem
This chapter assumes you know how t-SNE turns high-dimensional distances into probabilities, including the role of perplexity. It also assumes basic probability and the idea of a similarity kernel. Here we cover the low-dimensional side: how t-SNE measures similarity in the 2-D map, and why it uses a heavy-tailed kernel to do so.
The crowding problem
In high dimensions, a point can have many neighbours at about the same moderate distance. In 10 dimensions, for example, you can place 11 points that are all equally far from each other. In 2 dimensions you can place only 3.
When you squeeze data into 2-D, there is not enough room around each point for its moderately distant neighbours. Those points get pushed toward the centre of the map and pile on top of each other. Clusters then merge and the gaps between them vanish. This is the crowding problem.
Gaussian versus Student-t similarities
The original method, SNE, used a Gaussian kernel in both spaces. A Gaussian falls off very fast, so moderately distant points get almost no similarity. The optimiser could not afford to place them far apart, and crowding followed.
t-SNE keeps the Gaussian in the high-dimensional space but uses a Student-t distribution with one degree of freedom (a Cauchy distribution) in the map. For map points yi and yj, the low-dimensional similarity is:
qij = (1 + ||yi − yj||²)⁻¹ / Σ{k≠l} (1 + ||yk − yl||²)⁻¹
The numerator decays polynomially, roughly as 1/d², not exponentially. Its tails are heavy.
import numpy as np
d = np.array([0.5, 1, 2, 4, 8])
gaussian = np.exp(-d**2)
student_t = 1 / (1 + d**2)
for di, g, t in zip(d, gaussian, student_t):
print(f"distance {di:>4}: gaussian = {g:.5f}, student-t = {t:.5f}")At distance 8 the Gaussian is about 1e-28, while the Student-t value is about 0.015. That gap is the point.
Why heavy tails fix crowding
Suppose two points have a moderate similarity pij in the original space. To match it with qij, the map must place them at some distance.
- With a Gaussian, a small q_ij needs only a modest distance, so the pair stays close.
- With a Student-t, a small q_ij needs a much larger distance, because q falls off slowly.
So moderately distant pairs are pushed further apart in the map. This frees up room, and clusters separate, with visible gaps between them.
Side effects to remember
The heavy tail also shapes how you should read the result.
- Within a cluster, points attract each other and form tight groups.
- Between clusters, a weak repulsion acts at long range, so gaps appear. Their width is not a reliable measure of true separation.
- The kernel has no free scale parameter. Its shape is fixed, so the map's overall scale emerges from the optimisation.
Exercise
A colleague replaces the Student-t kernel in the map with a Gaussian of the same width. What problem do you expect to see in the embedding, and why?
Show answer
You would expect crowding. Gaussian similarities fall to nearly zero at moderate distances, so the optimiser can match a small p_ij with a short map distance. Moderately distant points then stay close to each other and to the centre, and clusters merge instead of separating.