graphclust.cluster.SpectralGraphClustering#

class graphclust.cluster.SpectralGraphClustering(n_clusters=2, *, affinity='self_tuning', k=10, max_clusters=10, random_state=None)[source]#

Bases: ClusterMixin, BaseEstimator

Normalized spectral clustering (Ng, Jordan and Weiss 2002) on a neighborhood graph.

Affinities:

  • "self_tuning": \(a_{ij}=\exp(-d_{ij}^2/(\sigma_i\sigma_j))\) on the symmetric k-NN graph with local scales \(\sigma_i\) = distance to the k-th neighbor (Zelnik-Manor and Perona 2004);

  • "fuzzy": the fuzzy neighborhood similarity matrix;

  • "precomputed": X is an affinity matrix.

The n_clusters leading eigenvectors of \(\mathbf{D}^{-1/2}\mathbf{A}\mathbf{D}^{-1/2}\) are row-normalized and clustered with k-means. With n_clusters="auto" the number of clusters is taken at the largest relative gap of the Laplacian eigenvalues \(\mu_l=1-\lambda_l\) among the first max_clusters (graphclust.validity.eigengap()).