Spectral embedding — coordinates from the graph Laplacian
Spectral embedding builds a similarity graph and uses the smallest eigenvectors of its Laplacian as coordinates. Rows that are strongly connected end up close together. The embedding is what spectral clustering uses before it runs K-Means, so if your clusters are defined by connectivity rather than by blobs, these coordinates are the space in which that becomes visible.
The affinity decides the edges. A nearest-neighbor affinity keeps the graph local and is the right default when you suspect manifolds or communities. An RBF affinity connects everyone with a decaying weight and needs a width that matches the column scales. A bad width produces either an empty graph or a complete one, and both embeddings are noise.
Eigenvectors come with an arbitrary sign and an arbitrary order beyond the eigenvalue. Do not compare the sign of coordinate 1 across two runs. Compare neighborhoods.
Settings that change this fit
- n components
- How many Laplacian eigenvectors are kept. Two or three to look at, more if the embedding feeds another model.
- affinity
- Nearest neighbors for local structure. RBF for a smooth decay. The choice changes the graph, not just the drawing.