CMEANS |
K-means clustering algorithm.
Synopsis:
[model,y] = cmeans(X,num_centers)
[model,y] = cmeans(X,num_centers,Init_centers)
Description:
[model,y] = cmeans(X,num_centers) runs C-means clustering
where inital centers are randomly selected from the
input vectors X. The output are found centers stored in
structure model.
[model,y] = cmeans(X,num_centers,Init_centers) uses
init_centers as the starting point.
Input:
X [dim x num_data] Input vectors.
num_centers [1x1] Number of centers.
Init_centers [1x1] Starting point of the algorithm.
Output:
model [struct] Found clustering:
.X [dim x num_centers] Found centers.
.y [1 x num_centers] Implicitly added labels 1..num_centers.
.t [1x1] Number of iterations.
.MsErr [1xt] Mean-Square error at each iteration.
y [1 x num_data] Labels assigned to data according to
the nearest center.
Example:
data = load('riply_trn');
[model,data.y] = cmeans( data.X, 4 );
figure; ppatterns(data);
ppatterns(model,12); pboundary( model );
See also
EMGMM, KNNCLASS.
(c) Statistical Pattern Recognition Toolbox, (C) 1999-2003,
Written by Vojtech Franc and Vaclav Hlavac,
Czech Technical University Prague,
Faculty of Electrical engineering,
Center for Machine Perception
Modifications:
18-dec-2008, VF, fix: Init_centers argument used as the initial solution
17-jun-2007, VF, renamed from kmeans to cmeans to avoid conflicts with stats toolbox
12-may-2004, VF