Simple Algorithm
Machine Learning · Convergence · 28 min

Spectral Clustering

Graph Laplacians, cuts and eigenvectors.

Two interleaved half-moons defeat k-means, yet a few eigenvectors can pull them apart. Spectral clustering builds a graph that joins nearby points, then uses the bottom eigenvectors of the graph's Laplacian to embed the points so that the clusters become easy to separate. This lesson proves why it works: the Laplacian counts connected components, its eigenvectors solve relaxations of the NP-hard RatioCut and normalized cut, Cheeger's inequality controls the cuts they produce, and in random graphs with two planted communities the limits of community detection are known exactly.

What you’ll learn

  • Build ε\varepsilon-neighborhood, kk-nearest-neighbor and Gaussian similarity graphs, and prove the basic properties of the graph Laplacian L=D−WL=D-W and its two normalized versions.
  • Derive spectral clustering as a relaxation of RatioCut and of normalized cut, and implement the Ng–Jordan–Weiss algorithm.
  • State Cheeger's inequality, prove its easy direction, and state its higher-order version and a gap condition under which spectral clustering provably recovers clusters.
  • Summarize when spectral clustering is statistically consistent, and the thresholds for detecting and exactly recovering communities in the stochastic block model.

Similarity graphs and their Laplacians

Spectral clustering starts from a weighted graph on the nn points, with symmetric weights wij≥0w_{ij}\ge0 that are large for similar points. Three constructions are standard: the ε\varepsilon-neighborhood graph joins points within distance ε\varepsilon; the kk-nearest-neighbor graph joins ii and jj if either is among the other's kk nearest neighbors (or, in the mutual version, if both are); and the fully connected graph uses Gaussian weights wij=exp⁡(−∥xi−xj∥2/(2σ2))w_{ij}=\exp\big(-\norm{\mathbf x_i-\mathbf x_j}^2/(2\sigma^2)\big), the RBF kernel. Write di=∑jwijd_i=\sum_jw_{ij} for the degree of vertex ii, D=diag⁡(d1,…,dn)D=\diag(d_1,\dots,d_n), and vol(A)=∑i∈Adi\mathrm{vol}(A)=\sum_{i\in A}d_i.

DerivationThe Laplacian counts connected components
  1. f⊤Lf=∑idifi2−∑i,jwijfifj=12∑i,jwij(fi−fj)2 ≥ 0\mathbf f^\top L\mathbf f=\sum_id_if_i^2-\sum_{i,j}w_{ij}f_if_j=\frac12\sum_{i,j}w_{ij}(f_i-f_j)^2\ \ge\ 0

    Expand the quadratic form with di=∑jwijd_i=\sum_jw_{ij} and symmetrize. Every term is nonnegative, so LL is positive semidefinite, and L1=0L\mathbf 1=\mathbf 0:

  2. ker⁡L=span⁡{1A1,…,1Ac}\ker L=\operatorname{span}\{\mathbf 1_{A_1},\dots,\mathbf 1_{A_c}\}

    If Lf=0L\mathbf f=\mathbf 0, the sum is zero, so fi=fjf_i=f_j whenever wij>0w_{ij}>0: f\mathbf f is constant on each connected component. Conversely, the indicator 1A\mathbf 1_A of a component satisfies L1A=0L\mathbf 1_A=\mathbf 0, because a vertex of AA has all its weight inside AA and other vertices have none there:

  3. dim⁡ker⁡L=dim⁡ker⁡Lrw=dim⁡ker⁡Lsym=c\dim\ker L=\dim\ker L_{\mathrm{rw}}=\dim\ker L_{\mathrm{sym}}=c

    So the multiplicity of the eigenvalue 0 is the number cc of connected components. The indicators are also the 0-eigenvectors of LrwL_{\mathrm{rw}}, while those of LsymL_{\mathrm{sym}} are the rescaled vectors D1/21AjD^{1/2}\mathbf 1_{A_j}, by the equivalences above.

Think first The smallest eigenvalues of a graph's normalized Laplacian are 0,0,0.03,0.05,1.4,1.7,…0, 0, 0.03, 0.05, 1.4, 1.7,\dots. How many clusters does the graph suggest?

Four. Two zero eigenvalues mean exactly two connected components. Two more eigenvalues close to 0 mean that the components can be cut further, into four groups in all with few edges between them. The jump from 0.050.05 to 1.41.4 is the eigengap, and the eigengap heuristic chooses kk just before it. Step 4 makes "close to 0" precise with Cheeger's inequality.

Spectral clustering relaxes graph cuts

For vertex sets A,BA,B let cut(A,B)=∑i∈A, j∈Bwij\mathrm{cut}(A,B)=\sum_{i\in A,\,j\in B}w_{ij}. The minimum cut usually just splits off one weakly attached vertex, so useful objectives balance the sizes. For a partition A1,…,AkA_1,\dots,A_k with complements Aˉj\bar A_j:

RatioCut=∑j=1kcut(Aj,Aˉj)∣Aj∣,NCut=∑j=1kcut(Aj,Aˉj)vol(Aj).\mathrm{RatioCut}=\sum_{j=1}^k\frac{\mathrm{cut}(A_j,\bar A_j)}{\abs{A_j}},\qquad\mathrm{NCut}=\sum_{j=1}^k\frac{\mathrm{cut}(A_j,\bar A_j)}{\mathrm{vol}(A_j)}.

Hagen & Kahng (1992) gave the spectral relaxation of the ratio cut, a balanced objective from circuit partitioning, and Shi & Malik (2000) introduced normalized cut for image segmentation. Adding the balance terms makes exact minimization NP-hard (von Luxburg, 2007, refers to Wagner & Wagner, 1993, for a discussion), and spectral clustering solves a relaxation instead.

DerivationRatioCut relaxes to the Fiedler vector (k = 2)
  1. f⊤Lf=cut(A,Aˉ)(∣Aˉ∣∣A∣+∣A∣∣Aˉ∣+2)=cut(A,Aˉ) n(1∣A∣+1∣Aˉ∣)=n⋅RatioCut(A,Aˉ)\mathbf f^\top L\mathbf f=\mathrm{cut}(A,\bar A)\Big(\frac{\abs{\bar A}}{\abs A}+\frac{\abs A}{\abs{\bar A}}+2\Big)=\mathrm{cut}(A,\bar A)\,n\Big(\frac1{\abs A}+\frac1{\abs{\bar A}}\Big)=n\cdot\mathrm{RatioCut}(A,\bar A)

    Encode a split (A,Aˉ)(A,\bar A) by fi=∣Aˉ∣/∣A∣f_i=\sqrt{\abs{\bar A}/\abs A} for i∈Ai\in A and fi=−∣A∣/∣Aˉ∣f_i=-\sqrt{\abs A/\abs{\bar A}} for i∈Aˉi\in\bar A. In 12∑i,jwij(fi−fj)2\frac12\sum_{i,j}w_{ij}(f_i-f_j)^2 only the pairs that cross the cut contribute, each unordered pair once:

  2. ∑ifi=∣A∣∣Aˉ∣∣A∣−∣Aˉ∣∣A∣∣Aˉ∣=0,∥f∥2=∣Aˉ∣+∣A∣=n\sum_if_i=\abs A\sqrt{\frac{\abs{\bar A}}{\abs A}}-\abs{\bar A}\sqrt{\frac{\abs A}{\abs{\bar A}}}=0,\qquad\norm{\mathbf f}^2=\abs{\bar A}+\abs A=n

    The vector also satisfies two constraints that do not depend on the split:

  3. min⁡ARatioCut(A,Aˉ) ≥ λ2(L),and the split is read off from the signs of v2\min_{A}\mathrm{RatioCut}(A,\bar A)\ \ge\ \lambda_2(L),\qquad\text{and the split is read off from the signs of }\mathbf v_2

    Drop the requirement that f\mathbf f take two values. Minimizing f⊤Lf\mathbf f^\top L\mathbf f over f⊥1\mathbf f\perp\mathbf 1 with ∥f∥2=n\norm{\mathbf f}^2=n is a Rayleigh-quotient problem whose solution is n v2\sqrt n\,\mathbf v_2, the eigenvector of the second-smallest eigenvalue λ2\lambda_2 of LL (the Fiedler vector). Every split is feasible, so the relaxation also gives a lower bound:

  4. min⁡H⊤H=ITr⁡(H⊤LH)=∑i=1kλi(L) ≤ min⁡A1,…,AkRatioCut(A1,…,Ak)\min_{H^\top H=I}\operatorname{Tr}(H^\top LH)=\sum_{i=1}^k\lambda_i(L)\ \le\ \min_{A_1,\dots,A_k}\mathrm{RatioCut}(A_1,\dots,A_k)

    For kk clusters, put hij=1/∣Aj∣h_{ij}=1/\sqrt{\abs{A_j}} for i∈Aji\in A_j: then H⊤H=IH^\top H=I and Tr⁡(H⊤LH)=RatioCut\operatorname{Tr}(H^\top LH)=\mathrm{RatioCut}, and the relaxed problem is solved by the kk bottom eigenvectors of LL (Ky Fan). With hij=1/vol(Aj)h_{ij}=1/\sqrt{\mathrm{vol}(A_j)} instead, H⊤DH=IH^\top DH=I and Tr⁡(H⊤LH)=NCut\operatorname{Tr}(H^\top LH)=\mathrm{NCut}; substituting T=D1/2HT=D^{1/2}H turns it into the bottom eigenvectors of LsymL_{\mathrm{sym}}, or equivalently the generalized problem Lu=λDuL\mathbf u=\lambda D\mathbf u of Shi & Malik.

The relaxed solution is not a partition, so it is rounded, usually by running k-means on the rows of the n×kn\times k eigenvector matrix. Nothing in the relaxation guarantees that the rounded cut is near-optimal, and on specially constructed graphs it is far from it (Guattery & Miller, 1998). Step 4 shows what can be guaranteed, and the next step shows why the rows of the eigenvector matrix are good points to cluster.

The algorithms, and why they work

AlgorithmEigenvectors ofThen
Unnormalized (RatioCut)LL, the kk smallestk-means on the rows of U∈Rn×kU\in\R^{n\times k}
Shi & Malik (2000), normalized cutLu=λDuL\mathbf u=\lambda D\mathbf u, i.e. LrwL_{\mathrm{rw}}k-means on the rows (originally: recursive two-way splits by thresholding)
Ng, Jordan & Weiss (2002)LsymL_{\mathrm{sym}}, the kk smallestrescale every row of UU to unit length, then k-means
All three cost one eigendecomposition plus a k-means run. Von Luxburg's (2007) tutorial recommends the normalized versions, preferably with LrwL_{\mathrm{rw}}: normalized cut also rewards high similarity within clusters, which RatioCut ignores, and there are the consistency reasons of step 5.
python
import numpy as np
from scipy.linalg import eigh
from sklearn.cluster import KMeans

def njw_spectral_clustering(X, k, sigma):
    sq = ((X[:, None, :] - X[None, :, :]) ** 2).sum(axis=-1)   # pairwise squared distances
    W = np.exp(-sq / (2 * sigma ** 2))
    np.fill_diagonal(W, 0.0)
    d = W.sum(axis=1)
    M = W / np.sqrt(np.outer(d, d))                 # D^{-1/2} W D^{-1/2} = I - L_sym
    vals, vecs = eigh(M)                            # eigenvalues in ascending order
    U = vecs[:, -k:]                                # top k of M = bottom k of L_sym
    U = U / np.linalg.norm(U, axis=1, keepdims=True)
    return KMeans(n_clusters=k, n_init=10).fit_predict(U)

A dense version for a few thousand points: O(n2)\order{n^2} memory and O(n3)\order{n^3} time for the eigendecomposition. At scale, use a sparse kk-nearest-neighbor graph and an iterative eigensolver that computes only the kk vectors needed, or Nyström approximations of WW.

Why it works: the ideal case and its perturbation. Suppose the graph has exactly kk connected components. Then the bottom eigenspace of LrwL_{\mathrm{rw}} is spanned by the component indicators, so all rows of UU belonging to one cluster are identical (any orthonormal basis of the eigenspace is a rotation of the indicators), and k-means recovers the clusters perfectly. For LsymL_{\mathrm{sym}} the eigenvectors are D1/21AjD^{1/2}\mathbf 1_{A_j}, so rows of one cluster point in the same direction but have lengths proportional to di\sqrt{d_i}; rescaling each row to unit length sends every cluster to a single point on the sphere, which is the Ng–Jordan–Weiss step. Real graphs have a few edges between clusters, a small perturbation EE of the ideal Laplacian. By the Davis–Kahan theorem (the Convergence lesson Linear Algebra for ML: Eigenvectors & the SVD), the bottom-kk eigenspace rotates by an angle of order ∥E∥/gap\norm{E}/\text{gap}, where the gap separates λk\lambda_k from λk+1\lambda_{k+1}, so the rows stay close to kk well-separated points. This is the matrix-perturbation argument Ng, Jordan & Weiss used, and it is why a large eigengap is the signal to trust.

Kernel k-means, again. With weights did_i and a kernel built from WW, the weighted kernel k-means objective is equivalent to normalized cut (Dhillon, Guan & Kulis, 2004, 2007): the eigenvectors solve its relaxation, and k-means-style iterations attack the same objective directly.

Think first On two interleaved half-moons, why does k-means on the rows of the eigenvector matrix succeed where k-means on the original points fails?

Distances in the embedding reflect connectivity in the graph, not straight-line distance. A kk-nearest-neighbor graph links each moon into a chain of close points with almost no edges between the moons, so the graph is nearly two components; the embedding maps each moon close to its own point, and k-means separates the two compact groups. In the original plane, the moons are not convex and their tips are closer to the other moon's middle than to their own far end, which is what defeats k-means.

Cheeger's inequality and provable recovery

For a vertex set SS, the conductance ϕ(S)=cut(S,Sˉ)/min⁡{vol(S),vol(Sˉ)}\phi(S)=\mathrm{cut}(S,\bar S)/\min\{\mathrm{vol}(S),\mathrm{vol}(\bar S)\} measures how weakly SS is attached to the rest, and ϕ(G)=min⁡Sϕ(S)\phi(G)=\min_S\phi(S). Small conductance means a good two-way cluster, and up to a factor of 2 it is the two-way normalized cut.

DerivationProof of the lower bound
  1. λ2=min⁡{f⊤Lff⊤Df: f≠0, ∑idifi=0}\lambda_2=\min\Big\{\frac{\mathbf f^\top L\mathbf f}{\mathbf f^\top D\mathbf f}:\ \mathbf f\ne\mathbf 0,\ \sum_id_if_i=0\Big\}

    The bottom eigenvector of LsymL_{\mathrm{sym}} is D1/21D^{1/2}\mathbf 1. Substituting g=D1/2f\mathbf g=D^{1/2}\mathbf f in the Courant–Fischer characterization of the second eigenvalue gives:

  2. f⊤Lf=cut(S,Sˉ)(1vol(S)+1vol(Sˉ))2,f⊤Df=1vol(S)+1vol(Sˉ)\mathbf f^\top L\mathbf f=\mathrm{cut}(S,\bar S)\Big(\frac1{\mathrm{vol}(S)}+\frac1{\mathrm{vol}(\bar S)}\Big)^2,\qquad\mathbf f^\top D\mathbf f=\frac1{\mathrm{vol}(S)}+\frac1{\mathrm{vol}(\bar S)}

    For any set SS, test f=1S/vol(S)−1Sˉ/vol(Sˉ)\mathbf f=\mathbf 1_S/\mathrm{vol}(S)-\mathbf 1_{\bar S}/\mathrm{vol}(\bar S), which satisfies ∑idifi=1−1=0\sum_id_if_i=1-1=0. Only crossing pairs contribute to f⊤Lf\mathbf f^\top L\mathbf f:

  3. λ2≤cut(S,Sˉ)(1vol(S)+1vol(Sˉ))≤2 cut(S,Sˉ)min⁡{vol(S),vol(Sˉ)}=2ϕ(S)\lambda_2\le\mathrm{cut}(S,\bar S)\Big(\frac1{\mathrm{vol}(S)}+\frac1{\mathrm{vol}(\bar S)}\Big)\le\frac{2\,\mathrm{cut}(S,\bar S)}{\min\{\mathrm{vol}(S),\mathrm{vol}(\bar S)\}}=2\phi(S)

    The ratio is at most twice the conductance, because the larger of the two reciprocals is 1/min⁡{vol(S),vol(Sˉ)}1/\min\{\mathrm{vol}(S),\mathrm{vol}(\bar S)\}. Minimizing over SS gives λ2≤2ϕ(G)\lambda_2\le2\phi(G):

Predict before you look

A graph's normalized Laplacian has λ2=0.02\lambda_2=0.02. The sweep cut along the second eigenvector is guaranteed to have conductance at most what?

Show the answer

0.2

2λ2=0.04=0.2\sqrt{2\lambda_2}=\sqrt{0.04}=0.2. The lower bound says no cut does better than λ2/2=0.01\lambda_2/2=0.01. The gap between 0.010.01 and 0.20.2 is the quadratic loss of Cheeger's inequality, and each end is nearly tight on some graphs: on a long cycle the conductance is of order λ2\sqrt{\lambda_2}, far above λ2/2\lambda_2/2, while for two dense cliques joined by a single edge it is close to λ2/2\lambda_2/2.

The inequality extends to kk clusters. Measure a set's expansion by cut(S,Sˉ)/vol(S)\mathrm{cut}(S,\bar S)/\mathrm{vol}(S), and let ρG(k)\rho_G(k) be the smallest possible value of the largest expansion among kk disjoint nonempty vertex sets. Lee, Oveis Gharan & Trevisan (2014) proved

λk2 ≤ ρG(k) ≤ O(k2)λk,\frac{\lambda_k}2\ \le\ \rho_G(k)\ \le\ \order{k^2}\sqrt{\lambda_k},

so a graph has kk eigenvalues near zero exactly when it has kk disjoint sparsely connected pieces, which is the mathematical content of the eigengap heuristic. Peng, Sun & Zanetti (2017) turned it into a guarantee for the algorithm itself: if Υ=λk+1/ρ(k)\Upsilon=\lambda_{k+1}/\rho(k), the ratio of the (k+1)(k+1)-st eigenvalue to the same expansion quantity minimized over kk-way partitions, is Ω(k3)\Omega(k^3), then running any k-means algorithm with approximation ratio APT\mathrm{APT} on the spectral embedding returns clusters AiA_i with vol(Ai △ Si)=O(APT⋅k3/Υ)⋅vol(Si)\mathrm{vol}(A_i\,\triangle\,S_i)=\order{\mathrm{APT}\cdot k^3/\Upsilon}\cdot\mathrm{vol}(S_i), after matching them to an optimal partition S1,…,SkS_1,\dots,S_k.

Consistency and community detection

Consistency. As more points are drawn from a fixed distribution and the graph is built with a fixed similarity function, do the clusters converge? Von Luxburg, Belkin & Bousquet (2008) showed that the eigenvectors converge to those of limit operators, and that normalized spectral clustering converges under very general conditions, while unnormalized spectral clustering is consistent only under strong additional assumptions that real data can violate. That is a statistical reason to prefer LsymL_{\mathrm{sym}} or LrwL_{\mathrm{rw}}.

Community detection. In networks the graph is the data. The stochastic block model (Holland, Laskey & Leinhardt, 1983) generates one: each vertex gets a hidden community label, and edges appear independently, with probability pp inside a community and qq across. For the symmetric two-community model the limits of recovery are known exactly.

RegimeGoalPossible if and only ifEstablished by
p=a/np=a/n, q=b/nq=b/n (bounded average degree)detection: agree with the truth better than chance(a−b)2>2(a+b)(a-b)^2>2(a+b), the Kesten–Stigum thresholdconjectured by Decelle, Krzakala, Moore & Zdeborová (2011); impossibility below it: Mossel, Neeman & Sly (2015); algorithms above it: Massoulié (2014) and Mossel, Neeman & Sly (2018)
p=alog⁡n/np=a\log n/n, q=blog⁡n/nq=b\log n/nexact recovery: every vertex labeled correctly(a−b)2>2(\sqrt a-\sqrt b)^2>2Abbe, Bandeira & Hall (2016) and Mossel, Neeman & Sly (2016), both with efficient algorithms; a semidefinite program also reaches the threshold (Hajek, Wu & Xu, 2016)
Two communities of equal size, with a>ba>b. Once degrees grow, plain spectral clustering misclassifies only a vanishing fraction of vertices: with the normalized Laplacian in dense graphs (Rohe, Chatterjee & Yu, 2011), and with the adjacency matrix for expected degrees as small as order log⁡n\log n (Lei & Rinaldo, 2015).
Check your understanding

In a two-community stochastic block model with p=5/np=5/n and q=1/nq=1/n, can communities be detected better than chance as n→∞n\to\infty?

  1. No: the graph is so sparse that nothing can be detected
  2. Yes: (5−1)2=16(5-1)^2=16 exceeds 2(5+1)=122(5+1)=12
  3. Yes, but only by exhaustive search over all partitions
  4. No: detection needs pp to be at least twice qq times log⁡n\log n
Show the answer

B. Yes: (5−1)2=16(5-1)^2=16 exceeds 2(5+1)=122(5+1)=12

The Kesten–Stigum condition (a−b)2>2(a+b)(a-b)^2>2(a+b) holds, 16>1216>12, so efficient algorithms achieve better-than-chance agreement. Exact recovery is out of reach at this sparsity: with bounded average degree, a constant fraction of vertices have no edges at all.

In this sparse regime, plain spectral clustering of the adjacency matrix or a Laplacian fails: the eigenvectors it uses localize on a few vertices (for the adjacency matrix, the highest-degree ones) or on small, loosely attached pieces of the graph, and they hide the community signal. Krzakala, Moore, Mossel, Neeman, Sly, Zdeborová & Zhang (2013) proposed the non-backtracking matrix, which walks along directed edges without immediately reversing; its spectrum keeps the community eigenvalues separated from the bulk. They argued that it reaches the threshold, partly conjecturally, and Bordenave, Lelarge & Massoulié (2018) proved it.

Key takeaways

  • Spectral clustering builds a similarity graph (ε\varepsilon, kk-nearest-neighbor or Gaussian), computes the bottom eigenvectors of a graph Laplacian, and runs k-means on their rows. L=D−WL=D-W is positive semidefinite with f⊤Lf=12∑wij(fi−fj)2\mathbf f^\top L\mathbf f=\frac12\sum w_{ij}(f_i-f_j)^2, and its zero eigenvalues count connected components.
  • Its eigenvectors solve relaxations of NP-hard balanced cuts: RatioCut leads to LL (the Fiedler vector for two clusters), normalized cut to LrwL_{\mathrm{rw}} or LsymL_{\mathrm{sym}}; the relaxed value ∑i≤kλi\sum_{i\le k}\lambda_i lower-bounds the cut.
  • It works when the graph is close to kk disconnected pieces: Davis–Kahan perturbation explains the eigengap heuristic, Cheeger's inequality λ2/2≤ϕ(G)≤2λ2\lambda_2/2\le\phi(G)\le\sqrt{2\lambda_2} and its higher-order version tie small eigenvalues to sparse cuts, and a large gap λk+1/ρ(k)\lambda_{k+1}/\rho(k) makes recovery provable.
  • Normalized spectral clustering is statistically consistent under general conditions, unnormalized only under strong ones. In two-community stochastic block models, detection is possible exactly when (a−b)2>2(a+b)(a-b)^2>2(a+b) and exact recovery exactly when (a−b)2>2(\sqrt a-\sqrt b)^2>2; sparse graphs need non-backtracking operators.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

The unnormalized Laplacian L=D−WL=D-W of a graph has eigenvalue 00 with multiplicity 33. What does that tell you?

  1. The graph has exactly 3 isolated vertices
  2. The graph has exactly 3 connected components
  3. The best clustering has 3 clusters of equal size
  4. WW has rank 3
Show the answer

B. The graph has exactly 3 connected components

f⊤Lf=12∑wij(fi−fj)2\mathbf f^\top L\mathbf f=\frac12\sum w_{ij}(f_i-f_j)^2 vanishes exactly for vectors constant on each connected component, so the null space is spanned by the component indicators and its dimension counts the components.

Question 2

Relaxing the two-way RatioCut problem leads to which vector?

  1. The eigenvector of the largest eigenvalue of LL
  2. The constant vector 1\mathbf 1, the eigenvector of the smallest eigenvalue
  3. The eigenvector of the second-smallest eigenvalue of LL, the Fiedler vector
  4. The top eigenvector of WW
Show the answer

C. The eigenvector of the second-smallest eigenvalue of LL, the Fiedler vector

The encoding vector satisfies f⊥1\mathbf f\perp\mathbf 1 and ∥f∥2=n\norm{\mathbf f}^2=n, and f⊤Lf=n⋅RatioCut\mathbf f^\top L\mathbf f=n\cdot\mathrm{RatioCut}. Minimizing the Rayleigh quotient under f⊥1\mathbf f\perp\mathbf 1 gives the eigenvector of λ2\lambda_2; its signs suggest the split.

Question 3

Why does the Ng–Jordan–Weiss algorithm rescale each row of the eigenvector matrix to unit length before running k-means?

  1. Because the eigenvectors of LsymL_{\mathrm{sym}} for a cluster are proportional to di\sqrt{d_i}, so rows of one cluster share a direction but not a length
  2. To make the algorithm independent of σ\sigma
  3. Because k-means requires inputs of unit norm
  4. To remove the constant eigenvector
Show the answer

A. Because the eigenvectors of LsymL_{\mathrm{sym}} for a cluster are proportional to di\sqrt{d_i}, so rows of one cluster share a direction but not a length

In the ideal case the bottom eigenvectors of LsymL_{\mathrm{sym}} are D1/21AjD^{1/2}\mathbf 1_{A_j}, so vertices of different degree in the same cluster sit at different distances from the origin along one direction. Normalizing collapses each cluster to a single point on the unit sphere, and different clusters to orthogonal points, which k-means then separates easily.

Question 4

A two-community stochastic block model has p=9log⁡n/np=9\log n/n and q=log⁡n/nq=\log n/n. Is exact recovery of every label possible as n→∞n\to\infty?

  1. No: a−b=8a-b=8 is below 2(a+b)=202(a+b)=20
  2. Only partial recovery is possible, because some vertex always has more neighbors in the other community
  3. Yes: (9−1)2=4(\sqrt9-\sqrt1)^2=4 exceeds 2
  4. No: exact recovery requires q=0q=0
Show the answer

C. Yes: (9−1)2=4(\sqrt9-\sqrt1)^2=4 exceeds 2

The exact-recovery threshold is (a−b)2>2(\sqrt a-\sqrt b)^2>2, here (3−1)2=4>2(3-1)^2=4>2. Above it, with high probability every vertex has more neighbors inside its own community, and efficient algorithms recover all the labels.

Further reading

  • U. von Luxburg, "A tutorial on spectral clustering," Statistics and Computing 17(4), 395–416 (2007).
  • J. Shi & J. Malik, "Normalized cuts and image segmentation," IEEE Transactions on Pattern Analysis and Machine Intelligence 22(8), 888–905 (2000).
  • A. Y. Ng, M. I. Jordan & Y. Weiss, "On spectral clustering: analysis and an algorithm," Advances in Neural Information Processing Systems 14 (NIPS 2001) (MIT Press, 2002).
  • U. von Luxburg, M. Belkin & O. Bousquet, "Consistency of spectral clustering," Annals of Statistics 36(2), 555–586 (2008).
  • E. Abbe, "Community detection and stochastic block models: recent developments," Journal of Machine Learning Research 18(177), 1–86 (2018).