Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Why Distances Between Embedding Islands Are Unreliable

Dimension Reduction and Embeddings · Tutorial 225 of 700

Why Distances Between Embedding Islands Are Unreliable

Use t-SNE and UMAP geometry to distinguish informative local neighborhoods from unreliable distances and orientations between embedding islands.

Intermediate 12 min read

What You'll Learn

  • Explain why an island’s position and orientation need not encode its relationship to other islands.
  • Derive how moving or rotating an island can preserve its internal pairwise distances and local neighborhoods.
  • Identify how t-SNE’s global low-dimensional similarities can still respond to changes in island separation.
  • Interpret UMAP’s edge and nonedge contributions when disconnected groups move farther apart.
  • Recognize comparisons of island gaps, orientations, and displayed cross-island distances that plots cannot support.
  • Choose more appropriate evidence when a question concerns between-group similarity.

Why the gap between islands is tempting—and risky

A two-dimensional embedding can display several compact islands with visible gaps between them. It is natural to read a larger gap as greater dissimilarity, or to interpret the direction in which one island lies as meaningful. For t-SNE and UMAP, those readings are generally not justified by the plot alone. These methods are designed primarily to represent local relationships; the arrangement of separated groups is not a calibrated map of their original-space distances.

An island here means a separated region of displayed points, not necessarily a biological cluster. The earlier material on t-SNE pairwise similarities and UMAP’s nearest-neighbor graph established the local relationships each method tries to represent. This tutorial focuses on a different question: what can the displayed geometry between separated regions tell us?

Definition: An embedding island is a visually separated group of points in a low-dimensional display. A within-island neighborhood consists of nearby points belonging to the same island. The between-island separation is a displayed distance between points, summaries, or regions from different islands. These are properties of the displayed coordinates; they are not automatically equivalent to distances or relationships in the input space.

The distinction is important. If cells remain close to the same neighbors within each island, that local pattern may be informative about the embedding. But the gap between the islands, their left-to-right order, and their relative orientation can be much less constrained. In particular, a visual gap does not supply a unit of biological dissimilarity: twice the gap on the plot does not mean twice the difference in expression profiles.

A geometric justification: preserve local shape, change separation

Consider embedded points \(y_i\in\mathbb{R}^2\), and suppose the points are divided into two separated islands. Translate every point in one island by the same vector \(t\), so that \(y_i'=y_i+t\) for points in that island. For any two points \(i,j\) in that island,

$$ \|y_i'-y_j'\|=\|(y_i+t)-(y_j+t)\|=\|y_i-y_j\|. $$

Thus every within-island pairwise distance is unchanged. A common translation of the whole island also preserves its internal nearest-neighbor ordering. Yet distances from its points to the other island can change because the other island was not translated. If the translation moves the island farther away, those cross-island distances increase while its internal geometry stays fixed.

The same reasoning applies to rotation or reflection within an island. An orthogonal transformation \(R\), satisfying \(R^\mathsf{T}R=I\), preserves distances because \(\|R(y_i-y_j)\|^2=(y_i-y_j)^\mathsf{T}R^\mathsf{T}R(y_i-y_j)=\|y_i-y_j\|^2\). Rotating one island around its own center can therefore preserve its shape and local neighborhoods while changing how its points line up with points in another island. By contrast, translating or rotating the entire embedding preserves every pairwise distance; it only changes the plot’s position or orientation on the page.

This geometric argument explains why a local pattern alone cannot determine a between-island arrangement. It does not show that an embedding algorithm’s full objective is exactly unchanged by independently moving islands. Both methods include interactions beyond a list of within-island neighbors. The argument establishes that the displayed local geometry does not, by itself, fix the gap or orientation.

Worked Example: Translating a t-SNE Island

Suppose a hypothetical t-SNE display has three points in island A at \((0,0)\), \((0,1)\), and \((1,0)\), and three points in island B at \((5,0)\), \((5,1)\), and \((6,0)\). Compare the original display with one in which every point in B is translated by \((10,4)\).

Check the internal distances. In B, the distance between \((5,0)\) and \((5,1)\) is \(1\), and the distance between \((5,0)\) and \((6,0)\) is also \(1\). After translation these points are \((15,4)\), \((15,5)\), and \((16,4)\); the corresponding distances remain \(1\) and \(1\). The full set of within-B distances is unchanged because translation cancels in every difference.

Compare the island centers. The original center of A is \((1/3,1/3)\), and the original center of B is \((16/3,1/3)\). Their separation is \(5\) coordinate units. After translating B, its center is \((46/3,13/3)\). The center-to-center displacement is \((15,4)\), so the new separation is

$$ \sqrt{15^2+4^2}=\sqrt{241}\approx 15.52\text{ coordinate units}. $$

The island B has the same internal shape and neighborhoods, while its displayed center is now much farther from A. These two coordinate configurations illustrate why internal neighborhood preservation cannot establish a meaningful scale for the gap. They are not a claim that both configurations have the same t-SNE objective value.

What the t-SNE objective does—and does not—guarantee

In t-SNE, \(p_{ij}\) represents the normalized high-dimensional similarity assigned to a pair of observations, and \(q_{ij}\) is the corresponding low-dimensional similarity. The embedding is optimized to reduce the Kullback–Leibler divergence

$$ \mathrm{KL}(P\|Q)=\sum_{i\ne j}p_{ij}\log\!\left(\frac{p_{ij}}{q_{ij}}\right). $$

The low-dimensional similarities depend on distances between points, typically through a heavy-tailed Student distribution and a normalization across pairs. Consequently, moving an island can affect \(q_{ij}\) for pairs in different islands and can change the objective. It would be incorrect to say that t-SNE is indifferent to every change in between-island distance.

However, this objective does not make the plotted gap a direct readout of high-dimensional dissimilarity. The original similarities are principally local, and low-dimensional similarities are jointly normalized. A cross-island pair’s displayed distance is affected by the whole embedding and its optimization, not simply set equal to an original-space distance. The objective can favor separating points that should have low similarity, but that does not calibrate the distance between island centers in the input space. Thus, a gap may reflect optimization and the need to arrange many points, rather than a quantitative measure of how different two cell groups are.

Worked Example: Why t-SNE Gaps Are Not Distance Ratios

Suppose a hypothetical input dataset has two pairs of island centers whose original-space Euclidean distances are \(2\) and \(4\) units. A t-SNE plot displays the corresponding center-to-center gaps as \(3\) and \(12\) coordinate units.

The input distance ratio is \(4/2=2\), whereas the displayed gap ratio is \(12/3=4\). The plot therefore does not preserve this ratio. Nor does the fact that one displayed gap is \(12\) units imply an input distance of \(12\) units: the coordinate units are those of the embedding and have no such calibration.

The conclusion is limited but important: these measurements do not support saying that the second pair is twice as dissimilar based on the plotted gaps. To compare original-space distances, one would need to calculate them from the chosen input representation and metric, rather than infer them from the t-SNE picture.

UMAP: graph connections and nonedge repulsion

UMAP constructs a weighted neighborhood graph in the input space and seeks an embedding that represents its fuzzy connections. In a common description of its low-dimensional membership curve,

$$ q_{ij}=\frac{1}{1+a\|y_i-y_j\|^{2b}}, $$

where \(a\) and \(b\) control the curve’s shape. If \(w_{ij}\) is the input graph’s fuzzy membership, the cross-entropy objective has attractive terms for connected pairs and repulsive terms for pairs with little or no input membership. For a pair, these contributions have the form

$$ -w_{ij}\log(q_{ij})-(1-w_{ij})\log(1-q_{ij}). $$

In practice, UMAP commonly uses negative sampling to approximate repulsion rather than evaluating every nonedge in full. When two islands have no graph edges between them, there is no attractive graph connection directly specifying their relative placement. Repulsion still influences their arrangement, but it does not turn the resulting gap into an estimate of an input-space distance. Optimization details and finite computation also matter.

Worked Example: Moving Disconnected UMAP Components

Consider a simplified hypothetical UMAP calculation with \(a=b=1\). Each of two components has two points joined by an edge of weight \(1\), and there are no edges between components. Place the first component at \((0,0),(1,0)\). Place the second at \((4,0),(5,0)\), or instead at \((10,0),(11,0)\). In either layout, each within-component edge has length \(1\), so its low-dimensional membership is

$$ q=\frac{1}{1+1^2}=0.5. $$

Each edge’s attractive contribution is therefore \(-\log(0.5)\approx 0.6931\), unchanged by the translation. The component shapes and their edge lengths also remain unchanged.

For a cross-component pair with input membership \(0\), the nonedge contribution is \(-\log(1-q)\). In the first layout, the four cross distances are \(3,4,4,5\). Their memberships are \(0.1000,0.05882,0.05882,0.03846\), giving a total nonedge contribution of approximately \(0.2658\). In the second layout, the cross distances are \(9,10,10,11\), giving memberships of approximately \(0.01220,0.009901,0.009901,0.008197\) and a total contribution of approximately \(0.0404\).

This simplified calculation shows that the full objective need not be unchanged when components move: nonedge repulsion changes. It also shows why the gap is not a direct measure of their input-space dissimilarity. Repulsion can favor more separation without specifying a biological distance scale. The calculation illustrates the objective’s terms; practical optimization may approximate repulsion through negative sampling.

Orientation, diagnostics, and comparisons the plot cannot support

A shared rotation of a whole embedding has no effect on any pairwise distance. More subtly, the internal orientation of one island relative to another need not encode a biological relationship. If the local shape of each island is preserved, changing one island’s orientation can alter which points appear to face or align with points in another island without changing its internal neighborhoods.

Worked Example: Rotating an Island Without Changing Its Local Shape

Suppose island A contains \((-1,0)\) and \((1,0)\), while island B contains \((-1,4)\) and \((1,4)\). Each island has an internal distance of \(2\), and their centers are separated by \(4\). Rotate B by \(90^\circ\) around its center \((0,4)\). Its points become \((0,3)\) and \((0,5)\); its internal distance remains \(2\), and the centers remain \(4\) units apart.

Before rotation, the distance from A’s point \((-1,0)\) to B’s point \((-1,4)\) is \(4\). After rotation, the distance from that same point in A to B’s point \((0,3)\) is

$$ \sqrt{(0-(-1))^2+(3-0)^2}=\sqrt{10}\approx 3.162\text{ coordinate units}. $$

The island B retains its local geometry, but its apparent alignment with A changes. That visual alignment is not, by itself, evidence about corresponding cell types or shared biological structure.

Useful diagnostics begin by asking what claim is being made. A claim about whether points remain local neighbors concerns a different property from a claim about the distance between island centers. Inspect neighborhood relationships and the original representation when the question concerns local similarity; do not substitute a gap measurement for an input-space comparison. Also check whether the apparent separation is sensitive to reasonable analysis choices. A gap that changes while internal neighborhoods appear similar is a warning against interpreting it as a stable between-group quantity.

The central comparisons that the plot alone cannot justify include ranking islands by how dissimilar they are, treating ratios of displayed gaps as ratios of biological differences, and interpreting left-right order or relative orientation as meaningful. Nor does a visible gap establish that a transition is absent in the underlying data. These conclusions require evidence beyond the displayed arrangement.

Alternatives depend on the scientific question. If the question concerns distances in a specified input representation, calculate those distances using the chosen metric. If it concerns whether groups are linked by the input neighborhood structure, examine the graph construction and its connections. If the question concerns a display method that more directly preserves large-scale linear distances, principal component analysis may be relevant, while still requiring attention to which components are displayed and what information they omit. Each choice answers a different question; none makes a t-SNE or UMAP gap a calibrated distance after the fact.

Common mistake and practical rule

  • Wrong reasoning: “Island B is twice as far from island A in the plot, so the cell groups are twice as different.”
  • Correction: The plotted gap is measured in embedding coordinates, not a calibrated scale of input-space dissimilarity. Compare the relevant input-space quantities directly if the scientific question is about between-group distance.
  • Wrong reasoning: “The islands face each other, so their facing edges must be biologically related.”
  • Correction: Relative orientation can change while each island retains its internal geometry. Orientation alone does not establish correspondence or biological relationship.
Key takeaway: t-SNE and UMAP plots are most defensible as displays of local structure, interpreted with care. Island gaps, relative orientations, and cross-island distances are not automatically meaningful measures of relationships in the input data.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. If every point in an island is translated by the same vector, what happens to its internal pairwise distances? What can happen to its distances from another island?
  2. Why does the t-SNE objective not make a plotted gap a direct estimate of an original-space distance?
  3. In the simplified UMAP example with \(a=b=1\), calculate \(q_{ij}\) for a pair at distance \(2\).
  4. Two displays have the same within-island neighborhoods but different island-center gaps. What conclusion about biological dissimilarity is justified by that difference alone?
  5. What is one suitable next step if the scientific question concerns distances between groups in the input representation?

Solutions. (1) Internal pairwise distances are unchanged because the common translation cancels in every coordinate difference; distances to another island can change. (2) The objective optimizes normalized low-dimensional similarities to represent input similarities, which are principally local; it does not calibrate the island-center gap in input-space units. (3) \(q_{ij}=1/(1+2^2)=1/5=0.2\). (4) None about their relative biological dissimilarity follows from the gap difference alone; it is a change in displayed geometry. (5) Calculate between-group distances directly from the specified input representation using the metric relevant to the question.

Clinical Biostats