Spectral clustering — cut a similarity graph
Spectral clustering builds a similarity graph, takes the leading eigenvectors of its Laplacian, and runs K-Means in that embedding. Rows that are similar stay close in the embedding even when the original cloud is a ring or two moons. The Euclidean shape of the raw columns stops being the thing that defines a cluster.
With an RBF affinity and k=3 on scaled Iris, the graph cut scored silhouette 0.460 and adjusted Rand 0.600 against species. That silhouette matches K-Means on this particular table because Iris clusters are already blob-like; the embedding had little non-convex structure to recover. The same settings on wine reached adjusted Rand 0.930, the strongest species-style recovery of the wine runs alongside the Gaussian mixture.
The RBF width decides who counts as a neighbor. Too narrow and the graph falls into disconnected specks. Too wide and it becomes one complete graph and the cut is arbitrary.
Settings that change this fit
- n_clusters
- How many eigenvectors are retained and how many groups the final K-Means finds in the embedding.
- affinity
- RBF connects rows by a Gaussian of their distance. A nearest-neighbor affinity connects only local edges and is the one to try when the groups are thin manifolds.