bipartitionShi | R Documentation |
Perform spectral clustering thanks to a similarity matrix (according to Shi and Malik, 2000).
bipartitionShi(sim)
sim |
similarity matrix. |
bipartitionShi returns a partition obtained by spectral clustering (according to Shi and Malik, 2000)
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. |
J. Shi, J. Malik, Normalized cuts and image segmentation, IEEE Transactions on Pattern Analysis and Machine Intelligence, 2000, 22(8), 888-905.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.