distortionMin {diffusionMap} | R Documentation |
Runs one K-means loop based on the diffusion coordinates of a data set, beginning from an initial set of cluster centers.
distortionMin(X, phi0, K, c0, epsilon = 0.001)
X |
diffusion coordinates, each row corresponds to a data point |
phi0 |
trivial left eigenvector of Markov matrix (stationary distribution of Markov random walk) in diffusion map construction |
K |
number of clusters |
c0 |
initial cluster centers |
epsilon |
stopping criterion for relative change in distortion |
Used by diffusionKmeans().
The returned value is a list with components
S |
labelling from K-means loop. n-dimensional vector with integers between 1 and K |
c |
K geometric centroids found by K-means |
D |
minimum of total distortion (loss function of K-means) found in K-means run |
DK |
n by k matrix of squared (Euclidean) distances from each point to every centroid |
Lafon, S., & Lee, A., (2006), IEEE Trans. Pattern Anal. and Mach. Intel., 28, 1393
data(annulus)
n = dim(annulus)[1]
D = dist(annulus) # use Euclidean distance
dmap = diffuse(D,0.03) # compute diffusion map
km = distortionMin(dmap$X,dmap$phi0,2,dmap$X[sample(n,2),])
plot(annulus,col=km$S,pch=20)
table(km$S,c(rep(1,500),rep(2,500)))