UMAP builds a weighted neighbour graph with membership strengths μj∣i=exp⁡ ⁣(−(dij−ρi)/σi), where ρi is the distance from i to its nearest neighbour. (a) For a point with k=3 neighbours at distances 1.0, 1.5 and 3.0, find ρ, solve for σ so the strengths sum to log⁡2k, and give the three strengths. (b) How are directed strengths combined into an undirected weight? (c) How do UMAP and t-SNE differ?

Unsupervised learning, t-SNE and UMAP
Level L4 Advanced. Length Long. Nature Th+Mat Both.

What's being asked

Whether you understand UMAP's graph construction, local connectivity and cross-entropy objective, and how they differ from t-SNE.

Key idea

UMAP turns each point's neighbourhood into a fuzzy set whose nearest neighbour has strength exactly 1 (via ρi), symmetrises the graph with the probabilistic t-conorm a+b−ab, then lays it out in low dimensions by minimising the cross-entropy between the high- and low-dimensional edge weights.

Steps

  1. The nearest neighbour is at distance 1.0, so ρ=1. Subtracting it makes the nearest neighbour's strength e0=1, which guarantees every point is connected to at least one neighbour (local connectivity).
  2. The shifted distances are 0, 0.5 and 2.0. We need 1+e−0.5/σ+e−2/σ=log⁡23≈1.585, i.e. e−0.5/σ+e−2/σ=0.585. This has no closed form, so σ is found by binary search: σ≈0.753.
  3. The strengths are 1, e−0.5/0.753≈0.515 and e−2/0.753≈0.070. They sum to 1.585, as required. Here σ plays the role that perplexity plays in t-SNE.
  4. The directed weights a=μj∣i and b=μi∣j differ, because each point has its own ρ and σ. Combine them as wij=a+b−ab (the probability that at least one of two independent edges exists). For a=0.515 and b=0.3, wij=0.815−0.1545≈0.66.
  5. In the embedding, edge weights are vij=(1+α∥yi−yj∥2β)−1 (with constants α,β fitted from `min_dist`). UMAP minimises the cross-entropy ∑ij[wijln⁡wijvij+(1−wij)ln⁡1−wij1−vij] using stochastic gradient descent, with negative sampling for the repulsive term.
  6. Differences from t-SNE: the second (repulsive) term pushes non-neighbours apart, so global structure is better kept; no normalisation over all pairs is needed, which makes it faster and lets it embed into more than 2 dimensions; and a non-random initialisation (spectral) gives more stable results. The `min_dist` parameter controls how tightly points are packed.

Common mistakes

How long your answer should be

One page; 8 minutes.

Last checked on 4 December 2026.

Read this

Previous in Unsupervised learning: In locally linear embedding (LLE), the weights wj reconstruct a point x from its neighbours ηj by minimising ∥x−∑jwjηj∥2 subject to ∑jwj=1. (a) Derive the closed-form weights using the local Gram matrix. (b) For x=(0,0) with neighbours η1=(1,0) and η2=(0,2), compute the weights. (c) What is the second stage of LLE, and why is regularisation needed when k>d?
Next in Unsupervised learning: Why is the log-likelihood of a Gaussian mixture unbounded above when each component has its own covariance matrix? How do you show it in one dimension with K=2, and how do EM implementations avoid the problem?