SpectralEigens: Eigenvalues for spectral clustering

View source: R/spectral_clustering.R

SpectralEigensR Documentation

Eigenvalues for spectral clustering

Description

Spectral clustering emphasizes nearest neighbours when forming clusters; it avoids some of the issues that arise from clustering around means / medoids.

Usage

SpectralEigens(D, nn = 10L, nEig = 2L)

SpectralClustering(D, nn = 10L, nEig = 2L)

Arguments

D

Square matrix or dist object containing Euclidean distances between data points.

nn

Integer specifying number of nearest neighbours to consider

nEig

Integer specifying number of eigenvectors to retain.

Value

SpectralEigens() returns spectral eigenvalues that can then be clustered using a method of choice.

Author(s)

Adapted by MRS from script by Nura Kawa

See Also

Other tree space functions: MSTSegments(), MapTrees(), MappingQuality(), cluster-statistics, median.multiPhylo()

Examples

library("TreeTools", quietly = TRUE)
trees <- as.phylo(0:18, nTip = 8)
distances <- ClusteringInfoDistance(trees)
eigens <- SpectralEigens(distances)
# Perform clustering:
clusts <- KMeansPP(dist(eigens), k = 3)
plot(eigens, pch = 15, col = clusts$cluster)
plot(cmdscale(distances), pch = 15, col = clusts$cluster)

TreeDist documentation built on Oct. 26, 2023, 1:07 a.m.