Learn R Programming

RclusTool (version 0.91.61)

bipartitionShi: Spectral clustering

Description

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

Usage

bipartitionShi(sim)

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.

Arguments

sim

similarity matrix.

Details

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

References

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

Examples

Run this code
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")

Run the code above in your browser using DataLab