Foundations to Frontier
Tests
D. Classical Machine Learning › D9 Dimensionality Reduction and Manifold Learning

Diffusion Maps

Diffusion maps (Coifman and Lafon, 2006) turn a kernel on the data into a random walk and embed points by how similarly walks starting from them spread out. The diffusion distance at time t compares the t-step transition probabilities of two points; it equals the ordinary Euclidean distance between their diffusion coordinates, the walk's eigenvectors scaled by λᵗ. Averaging over all paths makes it robust to noise and short-circuits, and the time t acts as a scale knob: larger t keeps only coarse structure such as clusters. An α-normalisation chooses which continuum operator the walk approximates: α = 0 gives the normalised graph Laplacian, which is biased by sampling density; α = ½ a Fokker–Planck operator; α = 1 the Laplace–Beltrami operator, recovering the manifold's geometry whatever the sampling. This page covers the kernel and Markov matrix, diffusion distance and its spectral identity, multiscale behaviour, α-normalisation, Nyström extension, and links to Laplacian eigenmaps and reaction coordinates. In the exercises you verify the diffusion-distance identity and watch clusters emerge as t grows; then you measure how α corrects an embedding of an unevenly sampled circle.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Closeness measured by random walks

Drop a drop of ink on a data point and let it spread to nearby points, a little at a time. Two points are “close” if their ink blots, after a while, cover the same places. Ink spreads easily within a dense cluster or along a thin curve, but slowly across gaps. Diffusion maps place points so that ordinary distance on the map equals this ink-blot distance. Waiting longer lets the ink spread further and shows only the big-picture structure.

Diffusion maps: random walks, density and time
data (colour = angle)diffusion map (ψ₁, ψ₂)·λᵗλᵗ for eigenvectors 1–8
RMS angle error of the map 0.102 rad · λ₁, λ₂ = 0.9940, 0.9878 · λ₃ᵗ/λ₁ᵗ = 0.978
With uneven sampling and α = 0, the walk lingers where points are dense, and the map's angles bunch up: colours crowd one side of the ring. α = 1 divides out the density, so the map approximates the true geometry (the Laplace–Beltrami eigenfunctions cos θ and sin θ) whatever the sampling, and the angle error falls several-fold. Increasing t shrinks every coordinate by λᵗ; the higher, faster-decaying coordinates vanish first, so diffusion time acts as a scale knob that keeps only the coarse structure.
Why engineers care

Diffusion maps find slow variables, the reaction coordinates, in molecular and fluid simulations. They give robust low-dimensional states for system identification and control, and they organise sensor data by operating mode while ignoring how often each mode was sampled. The diffusion distance is robust because it averages over all paths, not the single shortest one that Isomap uses.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Diffusion distance compares…
  2. 2. Waiting longer (larger t) shows…
  3. 3. With uneven sampling, α = 1…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

Kernel, walk and distance by hand

Kernel. Kᵢⱼ = exp(−‖xᵢ − xⱼ‖²/ε). Points 1 apart with ε = 2 get e^(−0.5) = 0.607; each point has weight 1 with itself.

α-normalisation. Let qᵢ = Σⱼ Kᵢⱼ, a kernel density estimate. Form K⁽ᵅ⁾ᵢⱼ = Kᵢⱼ/(qᵢ^α qⱼ^α), then the Markov matrix P = D⁻¹K⁽ᵅ⁾ by dividing each row by its sum dᵢ. With α = 0 this is plain row normalisation.

Stationary distribution. For a symmetric kernel, the walk’s stationary distribution is π ∝ d. Row sums (3, 3, 4) give π = (0.3, 0.3, 0.4).

Diffusion distance. Dₜ(i, j)² = Σₖ (Pᵗᵢₖ − Pᵗⱼₖ)²/πₖ. For the walk P = [[½, ½, 0], [¼, ½, ¼], [0, ½, ½]] with π = (¼, ½, ¼), the ends 0 and 2 have rows (½, ½, 0) and (0, ½, ½), so D₁ = √(¼/¼ + 0 + ¼/¼) = √2 = 1.414. As t → ∞, every row of Pᵗ tends to π and every distance tends to 0.

Coordinates. With right eigenvectors Pψⱼ = λⱼψⱼ (λ₀ = 1, ψ₀ = 1), the diffusion map is Ψₜ(x) = (λ₁ᵗψ₁(x), λ₂ᵗψ₂(x), …). A coordinate with λ = 0.964 keeps 0.964¹⁶ = 0.556 of its size at t = 16, while one with λ = 0.5 drops below 1% after 7 steps.

The steps in plain English:

  1. Choose ε (for example the median squared neighbour distance) and compute the Gaussian kernel, sparsified to neighbours if n is large.
  2. Apply the α-normalisation (α = 1 for geometry, whatever the sampling), then row-normalise into P.
  3. Compute the top eigenvectors of P via the symmetric matrix D^(−½)K⁽ᵅ⁾D^(−½).
  4. Scale by λᵗ, drop ψ₀, and keep the coordinates whose λᵗ is not negligible.
📝 Quick check (Level 1)
0/3 answered
  1. 1. The largest eigenvalue of P is…
  2. 2. α = 0 normalisation is…
  3. 3. As t → ∞, diffusion distances…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 30 minUndergraduate students and practising engineers.

The spectral identity, scale and density

Diffusion distance is Euclidean in diffusion coordinates. Expand Pᵗ in its eigenvectors: Pᵗᵢₖ = Σₗ λₗᵗ ψₗ(i) φₗ(k), where the left eigenvectors are φₗ = π ψₗ, normalised so that Σ π ψₗ ψₘ = δₗₘ. Then

Dₜ(i, j)² = Σₗ λₗ²ᵗ (ψₗ(i) − ψₗ(j))² = ‖Ψₜ(i) − Ψₜ(j)‖².

The l = 0 term vanishes because ψ₀ is constant. Truncating to the coordinates with large λᵗ gives a controlled approximation.

Exercise 1 (three Gaussian blobs of 60 points, ε = 1, α = 1):

  • the identity held to 10⁻⁸ for every pair tested, at t = 1, 4 and 16;
  • the eigenvalues were 1, 0.964, 0.954, then a gap to 0.500 and 0.456;
  • the number of eigenvalues with λᵗ > 0.5, counting λ₀, was 4, 3, 2 and 1 at t = 1, 4, 16 and 64.

At t = 4, exactly 3 coordinates survive, one per cluster: two non-trivial coordinates separate three clusters. The between-cluster diffusion distance was 10.0 times the within-cluster one. At t = 64, everything has merged.

Why α matters. As ε → 0, the generator (I − P)/ε approaches a differential operator that depends on α and on the sampling density p:

  • α = 0: the normalised graph Laplacian, which carries a drift term ∇log p that pulls the embedding toward dense regions;
  • α = ½: a Fokker–Planck operator, the backward generator of a Langevin diffusion in the potential −log p;
  • α = 1: the Laplace–Beltrami operator, which ignores p and sees only the geometry.
# no scikit-learn estimator; a minimal implementation (pydiffmap and datafold provide full ones)
q = K.sum(1); Ka = K / np.outer(q, q); d = Ka.sum(1)                 # α = 1
lam, U = np.linalg.eigh(Ka / np.sqrt(np.outer(d, d))); psi = U / np.sqrt(d)[:, None]
🐍 Exercise 1: diffusion distance and diffusion time
Build the Gaussian kernel and α-normalised Markov matrix, compute diffusion coordinates, verify that diffusion distance from Pᵗ equals Euclidean distance between coordinates, and count how many coordinates survive as t grows on three blobs.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Diffusion distance equals Euclidean distance between…
  2. 2. In exercise 1 at t = 4, the number of surviving coordinates (with λ₀) matched…
  3. 3. α = ½ corresponds to…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Convergence and bandwidth. For ε → 0 and n → ∞ with nε^(d/2 + 1) → ∞, the α-normalised operator converges pointwise, and spectrally under further conditions. The bias is of order ε, and the variance grows as ε shrinks. Variable-bandwidth kernels (Berry and Harlim, 2016) adapt ε to local density, which helps on data with large density variation, such as the sparse side of the circle at c = 0.9.

Nyström extension. A new point x gets coordinates ψⱼ(x) = (1/λⱼ) Σᵢ P(x, xᵢ)ψⱼ(xᵢ), computed with the same kernel and normalisation. No recomputation is needed, but the extension is reliable only near the training data.

Reaction coordinates. For data from a stochastic dynamical system with time-scale separation, the leading diffusion coordinates (with α = ½, or α = 1 together with the right metric) approximate the slow variables (Nadler et al., 2006). That is why diffusion maps are popular in molecular dynamics and in coarse-graining.

Interview questions.

  • Diffusion maps or Laplacian eigenmaps? Same family. Diffusion maps add the α-normalisation, removing sampling bias, the time scaling λᵗ, giving a principled metric and multiscale view, and the diffusion-distance interpretation.
  • How do you choose t? By the spectral gap: choose t so that coordinates past the gap have negligible λᵗ, as at t = 4 in exercise 1. For visualisation t barely matters, since it only rescales axes; for distances it sets the scale.
📝 Quick check (Level 3)
0/3 answered
  1. 1. The Nyström extension embeds a new point using…
  2. 2. Variable-bandwidth kernels help when…
  3. 3. For visualisation, changing t mainly…

Level 4: Expert

★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.

Does α fix uneven sampling?

History.

  • R. Coifman and S. Lafon (2006) introduced diffusion maps and α-normalisation, building on R. Coifman et al. (2005) in PNAS.
  • B. Nadler, S. Lafon, R. Coifman and I. Kevrekidis (2006) linked them to spectral clustering and reaction coordinates.
  • T. Berry and J. Harlim (2016) introduced variable-bandwidth diffusion kernels.

Exercise 2. 500 points on a unit circle with angle density ∝ 1 + c·cos θ, ε = 0.05, 3 datasets. The table gives the RMS error (in radians) between the true angle and the angle read from the 2-D diffusion map, after removing the best rotation and reflection.

density contrast c α = 0 α = ½ α = 1
0 (uniform) 0.074 0.048 0.026
0.5 0.268 0.145 0.034
0.9 0.495 0.260 0.096
  • α = 1 was best in every case, and its advantage grew with the density contrast: 5 times smaller error than α = 0 at c = 0.9, and 8 times at c = 0.5.
  • α = ½ sat in between, as theory predicts. Its operator removes half of the density’s drift.
  • Even uniform sampling benefited from α = 1 (0.026 against 0.074): with finite samples the density is never exactly uniform, and α = 1 removes those random fluctuations too.
  • At c = 0.9 the sparse side has only 0.1/1.9 ≈ 5% of the peak density, so the α = 1 error (0.096) is mostly variance from too few points there, not bias. A variable bandwidth would help.
🐍 Exercise 2 (research): α-normalisation on an unevenly sampled circle
Sample a circle with density ∝ 1 + c·cos θ (c = 0, 0.5, 0.9), compute 2-D diffusion maps with α = 0, ½ and 1, and measure the RMS angle error after removing the best rotation and reflection.

Diffusion maps in AI, robotics and aerospace

  • Slow variables of dynamical systems: extract reaction coordinates or slow manifolds from simulation snapshots of combustion, fluid flow or molecular dynamics, then build reduced models.
  • Operating-mode discovery: cluster telemetry by diffusion distance at a moderate t, which is robust to noise and to how long each mode was flown.
  • Data fusion: alternating diffusion combines two sensors and keeps only the structure they share.

References

  1. R. R. Coifman, S. Lafon (2006). “Diffusion maps.” Applied and Computational Harmonic Analysis 21(1).
  2. B. Nadler, S. Lafon, R. R. Coifman, I. G. Kevrekidis (2006). “Diffusion maps, spectral clustering and reaction coordinates of dynamical systems.” Applied and Computational Harmonic Analysis 21(1).
  3. R. R. Coifman, S. Lafon, A. B. Lee, M. Maggioni, B. Nadler, F. Warner, S. W. Zucker (2005). “Geometric diffusions as a tool for harmonic analysis and structure definition of data: diffusion maps.” PNAS 102(21).
  4. T. Berry, J. Harlim (2016). “Variable bandwidth diffusion kernels.” Applied and Computational Harmonic Analysis 40(1).