Why Compare Separate and Joint Embeddings?
A modality-specific embedding represents cells using one assay, such as RNA expression or chromatin accessibility. A joint embedding represents cells using information combined across modalities. The comparison is not simply a contest to find the embedding with the most visible clusters. A joint representation may organize cells around structure shared by assays, while a modality-specific representation may retain variation that is strong in only one assay. The statistical question is therefore which relationships are preserved, which are changed, and whether those changes matter for the biological question.
The earlier material on diagnosing multimodal neighborhoods motivates examining local cell relationships rather than relying on a two-dimensional plot alone. Here the comparison is made directly on the same cells: first by measuring whether nearest-neighbor sets persist, and then by checking whether neighborhoods agree with biological labels or retain a prespecified subgroup. Neither neighborhood overlap nor label agreement proves that an embedding is biologically correct. Each is evidence about a particular property of the representation.
Making a Fair Neighborhood Comparison
A direct comparison requires that the two neighborhood sets refer to the same cell identities. Use cells measured in both embeddings, or otherwise define a valid matched set of cells before computing the scores. The definition also requires a common choice of \(k\), a specified distance measure within each embedding, and a rule for resolving distance ties. The distances themselves need not be on the same scale: Jaccard compares cell identities in the neighbor sets, not the numerical distances between cells.
The choice of \(k\) determines the scale being assessed. A small \(k\) emphasizes immediate local structure; a larger \(k\) includes broader neighborhoods. A single value can miss scale-dependent changes, so it is useful to report a small set of scientifically reasonable \(k\) values. The score is also sensitive to unstable neighbor lists: when several cells have nearly tied distances, small changes in preprocessing or the embedding algorithm can change set membership without a meaningful biological change.
Worked Example: Calculating Neighborhood Preservation
Suppose a hypothetical analysis uses four matched cells, A through D, and \(k=2\). For cell A, the RNA neighbors are \(\{B,C\}\) and the joint-embedding neighbors are \(\{B,D\}\). For B, the sets are \(\{A,C\}\) and \(\{A,C\}\); for C, they are \(\{A,D\}\) and \(\{B,D\}\); for D, they are \(\{B,C\}\) and \(\{B,C\}\). Compute the mean Jaccard preservation of the RNA neighborhoods in the joint embedding.
For A, the intersection is \(\{B\}\), and the union is \(\{B,C,D\}\), so \(J_{A,2}=1/3\). For B, both sets are identical, so \(J_{B,2}=2/2=1\). For C, the intersection is \(\{D\}\), and the union is \(\{A,B,D\}\), so \(J_{C,2}=1/3\). For D, both sets are \(\{B,C\}\), so \(J_{D,2}=1\).
Thus, across these four cells, the average overlap score is 0.667. This does not mean that 66.7% of distances or biological variation were preserved. It summarizes the overlap of fixed-size neighbor sets; the cell-specific scores show that preservation was perfect for B and D but partial for A and C.
Check Neighborhoods Against Biological Labels
Preserving neighbors is not the same as preserving biologically useful organization. If labels are available independently of the embedding, calculate the fraction of each cell’s neighbors that share its label, then average over cells. For cell labels \(L_i\), this neighborhood label agreement is
where \(\mathbf{1}(L_i=L_j)\) equals 1 when the labels match and 0 otherwise. This can be calculated separately for each modality-specific embedding and for the joint embedding. Its interpretation is descriptive: it measures how often a cell’s neighbors have its assigned label. It does not establish that the labels are correct, nor that the embedding caused the biological grouping.
A raw agreement score can be high simply because one label is common. A useful reference is the global label-mix baseline \(B=\sum_{\ell}q_{\ell}^{2}\), where \(q_{\ell}\) is the fraction of cells with label \(\ell\). This is the probability that two independently drawn labels from that mix agree. One descriptive chance-adjusted summary is \((A_k-B)/(1-B)\), provided \(B<1\). It is not a formal significance test: it does not account for spatial dependence among neighbors or uncertainty in estimated labels.
Worked Example: Comparing Label Agreement
Consider six hypothetical cells. A, B, and C have label X; D, E, and F have label Y. At \(k=2\), suppose the separate RNA neighborhoods are A:\(\{B,C\}\), B:\(\{A,C\}\), C:\(\{A,D\}\), D:\(\{E,F\}\), E:\(\{D,F\}\), and F:\(\{D,C\}\). Suppose the joint neighborhoods are A:\(\{B,D\}\), B:\(\{A,C\}\), C:\(\{B,D\}\), D:\(\{E,A\}\), E:\(\{D,F\}\), and F:\(\{D,E\}\).
In the RNA embedding, the fractions of same-label neighbors for A through F are \(1,1,1/2,1,1,1/2\). Therefore,
In the joint embedding, those fractions are \(1/2,1,1/2,1/2,1,1\), giving
Each label occurs in half the cells, so \(B=(1/2)^2+(1/2)^2=0.5\). The chance-adjusted descriptive values are \((0.833-0.5)/(1-0.5)\approx0.667\) for RNA and \((0.750-0.5)/(1-0.5)=0.500\) for the joint embedding. In this example, RNA neighborhoods agree more often with the supplied labels. That is a comparison for these labels and cells, not a general conclusion that RNA embeddings are preferable.
Why an Overall Score Can Hide a Subpopulation
An average over cells gives every cell equal weight, but a small assay-specific population may contribute too little to move the overall mean much. The relevant question may be whether cells from a prespecified subgroup remain neighbors of one another. For a subgroup \(S\) with at least two cells, define its \(k\)-neighbor retention as
This measures the fraction of the other subgroup members that appear in each member’s \(k\)-neighbor set, averaged across subgroup cells. It is most interpretable when the subgroup is prespecified using biological knowledge or an independent assay, rather than selected after inspecting the embedding. It should be considered alongside the overall overlap and label-agreement summaries.
Worked Example: Detecting Loss of a Small Assay-Specific Group
Suppose a hypothetical RNA embedding contains a two-cell accessibility-defined subgroup \(S=\{E,F\}\) among many common cells. With \(k=2\), E has neighbors \(\{F,G\}\) and F has neighbors \(\{E,H\}\). In the joint embedding, E has neighbors \(\{G,H\}\) and F has neighbors \(\{G,H\}\). Calculate subgroup retention in each embedding.
There is one other subgroup member for each cell. In the RNA embedding, F is a neighbor of E and E is a neighbor of F, so each cell’s retained fraction is \(1/1=1\), and \(R_{S,2}^{(\mathrm{RNA})}=1\). In the joint embedding, neither cell has the other as a neighbor, so both retained fractions are \(0/1=0\), and \(R_{S,2}^{(J)}=0\).
The joint embedding has removed this subgroup’s mutual local connection at the chosen scale. That is a reason to investigate the representation and the assay-specific biology, not proof that the joint embedding is invalid: the subgroup definition, neighbor scale, and measurement quality still matter. Because the group has only two cells, its retention estimate is also highly sensitive to individual neighbor choices.
Justifying the Jaccard Summary
The Jaccard score is a normalized count of shared neighbors. Let \(a\) be the number of neighbors shared by two sets, and let \(b\) be the number appearing in exactly one of them. Then their union has \(a+b\) elements, so the score is \(a/(a+b)\). Equivalently,
where \(N_1\triangle N_2\) is the symmetric difference, the elements in one set but not both. Since \(0\leq |N_1\cap N_2|\leq |N_1\cup N_2|\), the score is between 0 and 1. Identical nonempty sets have score 1; disjoint sets have score 0. For fixed-size \(k\)-neighbor sets, the union is nonempty whenever \(k\geq1\). This normalization makes the score interpretable as shared membership relative to all cells named by either neighborhood, not as a correlation between embedding coordinates.
Diagnostics, Alternatives, and Limitations
A sound comparison reports choices and checks sensitivity, rather than presenting a single score as a verdict. Useful diagnostics include:
- Neighborhood scale: Repeat the comparison at several plausible \(k\) values. A conclusion that reverses as \(k\) changes should be reported as scale-dependent.
- Cell-level distribution: Inspect the distribution of \(J_{i,k}\), not only its mean. A high mean can coexist with poor preservation for a specific cell type or rare group.
- Label balance and quality: Report label frequencies and how labels were assigned. Broad or uncertain labels can make agreement uninformative, while labels derived from the same features used to build an embedding can make apparent agreement partly circular.
- Stability: If the embedding procedure is stochastic or many neighbors have similar distances, repeat the analysis across reasonable runs or settings. Large changes in neighbor membership indicate that fine-grained conclusions are unstable.
- Subgroup coverage: Examine retention for biologically motivated populations as well as overall scores. State subgroup sizes, since estimates for very small groups are fragile.
Alternatives answer related but different questions. Trustworthiness penalizes cells that appear as neighbors in a low-dimensional representation despite being distant in a reference space; continuity penalizes reference neighbors that are omitted. These are useful when evaluating a dimensionality-reduction map against a chosen reference, but they do not by themselves test whether RNA and joint neighborhoods agree. Label purity or neighborhood agreement assesses alignment with labels, but can reward an embedding that separates labels while discarding within-label structure. Global distance or correlation summaries assess broad geometry, but can overlook local changes and rare subpopulations. The appropriate summary depends on whether the goal is preserving local relationships, organizing known labels, retaining a specific population, or representing broader geometry.
The central assumptions are modest but important: cell identities are matched correctly; the chosen distance and \(k\) define meaningful neighborhoods for each representation; and labels or subgroup definitions used for evaluation are sufficiently reliable for the intended interpretation. Neighbor preservation is not causal evidence, and labels are not a universal ground truth. A joint embedding may legitimately alter neighborhoods when modalities contribute complementary signals. Whether that alteration is useful depends on the biological task and on evidence beyond a single visualization or score.
Common Mistake
Wrong reasoning: “The joint embedding has a higher average neighborhood score, so it is better and preserves every biologically important population.” This treats an aggregate as a guarantee about each cell and assumes that neighborhood preservation is the only goal.
Correction: State exactly what the score compares, report the distribution or cell-level summaries, check label agreement and prespecified subgroup retention, and examine sensitivity to \(k\). A higher mean overlap supports greater average neighbor-set similarity at the selected scale; it does not establish better biological validity or rule out loss of an assay-specific subpopulation.
Check Your Understanding
Answer the questions, then compare with the short solutions below.
- If two \(k=5\) neighbor sets share three cells, what is their Jaccard score?
- Why can a high neighborhood label agreement be misleading when one label dominates the data?
- What does a low subgroup-retention score suggest, and what does it not prove?
- Why should neighborhood overlap be compared at more than one value of \(k\)?
- Name one question addressed by trustworthiness that is not identical to comparing RNA and joint neighbor sets.
Solutions. (1) Their union contains \(5+5-3=7\) cells, so the score is \(3/7\approx0.429\). (2) Many neighbors may share the dominant label by chance; compare with the label-mix baseline and inspect minority labels. (3) It suggests that subgroup members are not retained as one another’s neighbors at the chosen scale, but it does not prove the joint embedding is biologically invalid or identify why the change occurred. (4) Different \(k\) values assess different local scales, and conclusions can change with scale. (5) Trustworthiness asks whether neighbors introduced by a low-dimensional representation were non-neighbors in a chosen reference space.