How t-SNE matches neighbourhood affinities, what perplexity controls, and why a visually separated group does not establish global distance, density or causality.
t-SNE
t-SNE (t-distributed stochastic neighbour embedding) is a nonlinear dimensionality-reduction method that places observations in a small number of coordinates by matching neighbourhood affinities. A quant researcher can use its map to explore similarities among assets, market snapshots or text embeddings. A visible island is a prompt to inspect the underlying features; it does not establish a tradable regime or an economically distinct asset class.
The usual output is a two-dimensional scatterplot. Its axes are fitted map coordinates, without an inherent interpretation as return, risk or time. t-SNE emphasises local relationships, and its objective does not explicitly preserve global geometry. Scikit-learn’s manifold-learning guide describes this visualisation purpose and limitation.
Two probability descriptions of the same observations
Let xi be observation i in the original feature space and yi its map position. In the standard Euclidean formulation, t-SNE constructs conditional affinities
For each observation, nearby points receive more weight. The bandwidth σi is adjusted to a user-chosen perplexity, then the conditional affinities are symmetrised:
pij=2npj∣i+pi∣j,pii=0,i=j∑pij=1.
Here n is the number of observations. These are similarity probabilities, not probabilities of future market outcomes. The construction follows van der Maaten and Hinton (2008), §§2–3.1.
Perplexity expresses an effective neighbourhood size through entropy:
Perp(Pi)=2H(Pi),H(Pi)=−j=i∑pj∣ilog2pj∣i.
Uniform weights over m neighbours give perplexity m. Unequal weights make this a smooth measure rather than a hard count of retained neighbours. Larger perplexity generally brings a broader neighbourhood into the fit. It does not specify the number of clusters. The method author’s FAQ explains this interpretation; different values should be inspected rather than treated as interchangeable. Scikit-learn requires perplexity to be smaller than the number of observations in its TSNE implementation.
Why the map uses a Student-t kernel
In the standard map, affinities use a Student-t kernel with one degree of freedom:
The fitted positions minimise relative entropy, also called Kullback–Leibler divergence:
C=KL(P∥Q)=i=j∑pijlogqijpij.
Both sums count ordered pairs: (i,j) and (j,i) each contribute. A large pij represented by a tiny qij is costly, encouraging original neighbours to remain close.
The heavy tail addresses crowding: a low-dimensional map has too little room for many moderately distant neighbours. It lets those observations sit farther apart while retaining affinity. It does not guarantee faithful distances. See the original paper, §§3.2–3.3.
Check the normalisation with three fixed points
Take the illustrative, dimensionless map coordinates y1=0, y2=1 and y3=3. These are supplied positions, not the output of fitting t-SNE. No original features or pij values are supplied.
For the three unordered pairs, the distances are 1, 3 and 2. Therefore
w12=1+121=0.5,w13=1+321=0.1,w23=1+221=0.2.
Each weight occurs twice in the ordered-pair denominator:
Z=2(0.5+0.1+0.2)=1.6.
Thus q12=q21=0.3125, q13=q31=0.0625 and q23=q32=0.125. The total across six ordered events is one. The three entries above the diagonal sum to only 0.5; dividing by 0.8 would instead define probabilities over unordered pairs and would not match the displayed convention.
Fixed illustrative map coordinates 0, 1 and 3 give unordered distances 1, 3 and 2, weights 0.5, 0.1 and 0.2, and each ordered q of 0.3125, 0.0625 and 0.125. Counting both directions gives normaliser 1.6 and total probability 1.
Original fixed-coordinate calculation, not a fitted embedding. Each row represents two ordered events with the same affinity; all six events enter the normalisation.
The closest pair receives the largest q, but these numbers describe only this candidate map. Without P, they give neither a KL value nor evidence that the map preserves the original neighbourhoods.
Read the neighbourhoods, then test the story
A plotted group’s area does not measure its original dispersion or density. t-SNE can expand dense regions and contract sparse ones. Nor does twice the gap between two islands establish twice the original dissimilarity. Even an unclustered cloud can acquire apparent clumps. These effects are demonstrated in Wattenberg, Viégas and Johnson’s controlled examples, especially §§2–4.
For a financial exploration, state what each point represents, the feature window, scaling and distance definition. Compare several perplexities and initialisations, inspect original-space neighbours, and examine the underlying observations before naming a sector or regime. Formal clustering answers a separate modelling question; the picture alone supplies neither a cluster count nor a significance test. Its similarity objective also contains no causal identification assumptions, so separation cannot establish causation.
The optimisation is nonconvex: a fixed random seed helps reproduce a run, while different initialisations can yield different maps. For the same data, affinities and fitting settings, final KL values can help compare optimisation runs. A smaller KL is not independent evidence of economic usefulness. The author’s FAQ discusses this comparison; the current implementation reference documents the seed and optimisation parameters.
Standard t-SNE jointly fits the supplied observations; it does not automatically learn a reusable function for placing tomorrow’s point in today’s coordinates. Refitting with new observations can move old ones. Parametric t-SNE explicitly learns a mapping, as described in van der Maaten (2009); extensions need their own validation. In a historical forecasting experiment, allowing later observations to influence an earlier representation can introduce look-ahead bias, even without using target labels.