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?

Unsupervised learning, Isomap and LLE
Level L4 Advanced. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can solve the constrained least-squares problem for LLE weights and describe the embedding step.

Key idea

With Gjk=(x−ηj)⊤(x−ηk), the weights are w=G−111⊤G−11; the embedding then keeps these weights and finds low-dimensional points that satisfy the same reconstructions.

Steps

  1. Because ∑jwj=1, we can write x−∑jwjηj=∑jwj(x−ηj). So the error is ∑j,kwjwkGjk=w⊤Gw.
  2. Minimise w⊤Gw−2μ(1⊤w−1) using a Lagrange multiplier μ. Setting the gradient to zero gives Gw=μ1, so w=μG−11.
  3. The constraint 1⊤w=1 fixes μ=1/(1⊤G−11) and gives the weights in the key idea.
  4. Numbers: x−η1=(−1,0) and x−η2=(0,−2), so G=[1004] and G−11=(1,0.25), which sums to 1.25. So w=(0.8,0.2).
  5. Check: 0.8η1+0.2η2=(0.8,0.4). This is the point on the line through η1 and η2 nearest to x (it is perpendicular to the line direction (−1,2): −0.8+0.8=0). The residual is not 0 because x is not on that line.
  6. Stage two: keep W fixed and find low-dimensional points yi minimising ∑i∥yi−∑jwijyj∥2=tr⁡(Y⊤MY) with M=(I−W)⊤(I−W), under centring and unit-covariance constraints. The solution is the eigenvectors of M with the smallest non-zero eigenvalues. The constant eigenvector (eigenvalue 0) is discarded.
  7. If k>d (more neighbours than input dimensions), G is singular, as the neighbours are linearly dependent, so we replace G by G+ε tr⁡GkI with a small ε to make it invertible.

Common mistakes

How long your answer should be

One page; 8 minutes.

Last checked on 4 December 2026.

Read this

Previous in Unsupervised learning: For a similarity graph with symmetric non-negative weights W and degree matrix D, let L=D−W. How do you prove that f⊤Lf=12∑i,jwij(fi−fj)2, how does this show that the number of zero eigenvalues of L equals the number of connected components, and why does this justify spectral clustering?
Next in Unsupervised learning: 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?