bipartitionShi: Spectral clustering

View source: R/codeSpectral.R

bipartitionShiR Documentation

Spectral clustering

Description

Perform spectral clustering thanks to a similarity matrix (according to Shi and Malik, 2000).

Usage

bipartitionShi(sim)

Arguments

sim

similarity matrix.

Details

bipartitionShi returns a partition obtained by spectral clustering (according to Shi and Malik, 2000)

Value

The function returns a list containing:

label

vector of labels.

eigenvector

matrix containing, in columns, the eigenvectors of the similarity matrix.

eigenvalue

vector containing the eigenvalues of the similarity matrix.

References

J. Shi, J. Malik, Normalized cuts and image segmentation, IEEE Transactions on Pattern Analysis and Machine Intelligence, 2000, 22(8), 888-905.

Examples

dat <- rbind(matrix(rnorm(100, mean = 0, sd = 0.3), ncol = 2), 
           matrix(rnorm(100, mean = 2, sd = 0.3), ncol = 2))

sim <- computeGaussianSimilarity(dat, 1)
res <- bipartitionShi(sim)

plot(dat[,1], dat[,2], type = "p", xlab = "x", ylab = "y", 
col = res$label, main = "Initial features space")
plot(res$eigenvector, type = "p", xlab = "Indices", ylab = "1st eigenvector", 
col = res$label, main = "Spectral embedding")

RclusTool documentation built on Aug. 29, 2022, 9:07 a.m.