How is the eigengap heuristic used to determine the number of clusters in spectral clustering?
Last updated
Sort Laplacian eigenvalues ascending and pick k where the gap λ_{k+1} − λ_k is largest (e.g.
np.argmax(np.diff(eigvals)) + 1).Rationale: k well-separated clusters give k near-zero eigenvalues well below λ_{k+1}. A larger gap also means a more stable eigenvector embedding (Davis-Kahan).
It fails with noisy or overlapping clusters and is sensitive to graph construction (σ, kNN k). Cross-check with stability or silhouette analysis.