Spectral clustering emphasizes nearest neighbours when forming clusters; it avoids some of the issues that arise from clustering around means / medoids.
SpectralEigens(D, nn = 10L, nEig = 2L) SpectralClustering(D, nn = 10L, nEig = 2L)
Square matrix or
Integer specifying number of nearest neighbours to consider
Integer specifying number of eigenvectors to retain.
SpectralEigens() returns spectral eigenvalues that can then be
clustered using a method of choice.
Adapted by MRS from script by Nura Kawa
library('TreeTools', quietly = TRUE, warn.conflict = FALSE) trees <- as.phylo(0:18, nTip = 8) distances <- ClusteringInfoDistance(trees) eigens <- SpectralEigens(distances) # Perform clustering: clusts <- kmeans(dist(eigens), centers = 3) plot(eigens, pch = 15, col = clusts$cluster)