Data clustering using fuzzy c-means.
[centers,U,ofun,ofunk,em]=fcmeans(Xin,c,m [,maxiter [,epsilon [,verbose]]])
matrix of reals.The pairs of inputs points.
integer, number of clusters.
scalar, fizzifier constant.
integer, maximum number of iterations. The defaul value is 100
scalar, minimum change value between two consecutive iterations. The default value is 0.001
boolean, display information.The default value is %f.
fcmeans
find the c
number of clusters in the
data set Xin
using fuzzy c-means algorithm. The centers for
each cluster are returned in centers
. U
contains
the grade of membership of each Xin
point in each cluster.
ofun
is the last objetive function. ofunk
is the
objetive function in each iteration. em
is the exit mode, if
em
is %t
then the maximum number of iteration
maxiter
was reached, if em
is %f
then the minimum change between iteration epsilon
was
reached.
// Take 50 random pairs of points Xin=rand(100,2); // Find 7 clusters [centers,U,ofun,ofunk]=fcmeans(Xin,7,2); // Display information scf();clf(); subplot(2,2,1); plot2d(Xin(:,1),Xin(:,2),-1,rect=[0 0 1 1]); xtitle("Input pair of points","x","y"); subplot(2,2,3); plot2d(centers(:,1),centers(:,2),-2,rect=[0 0 1 1]); xtitle("Cluster centers","x","y"); subplot(2,2,2); plot(ofunk); xtitle("Objetive function in each iteration","k","ofun"); | ![]() | ![]() |