spectralEmbeddingNg: Spectral embedding

View source: R/codeSpectral.R

spectralEmbeddingNgR Documentation

Spectral embedding

Description

Build a spectral space from a similarity matrix (according to Ng et al., 2002).

Usage

spectralEmbeddingNg(sim, K)

Arguments

sim

similarity matrix.

K

number of clusters.

Details

spectralEmbeddingNg returns a spectral space built from a similarity matrix (according to Ng et al., 2002)

Value

The function returns a list containing:

x

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

eigen.val

vector containing the eigenvalues of the similarity matrix.

References

A. Ng, M. Jordan, Y. Weiss, On spectral clustering: Analysis and an algorithm, Neural Inf. Process. Systems NIPS14 (2002), pp. 849-856.

Examples

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

sim <- computeGaussianSimilarity(dat, 1)
res <- spectralEmbeddingNg(sim, K=3)

plot(res$x[,2], res$x[,3], type = "p", xlab = "2nd eigenvector", ylab = "3rd eigenvector")

RclusTool documentation built on May 29, 2024, 5:23 a.m.