| spectral_clustering | R Documentation |
Normalised (Ng-Jordan-Weiss) spectral clustering. Given a symmetric, non-negative affinity matrix it forms the normalised Laplacian, embeds the objects in the space of its leading eigenvectors and applies k-means.
spectral_clustering(affinity, k = NULL, max_k = 10, nstart = 10)
affinity |
A symmetric |
k |
Number of clusters. If |
max_k |
Upper bound for the eigengap search when |
nstart |
Number of k-means restarts. |
A list with cluster (named integer labels), k and the
spectral embedding.
Ng, A. Y., Jordan, M. I. & Weiss, Y. (2002). On spectral clustering: analysis and an algorithm. NIPS 14.
NEMO, SNF
set.seed(1)
X <- rbind(matrix(rnorm(20 * 5, 0), 20), matrix(rnorm(20 * 5, 6), 20))
A <- exp(-as.matrix(dist(X))^2 / 2)
spectral_clustering(A, k = 2)$cluster[1:5]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.