fcm
Purpose
Synopsis
[center,U,obj_fcn] = fcm(data,cluster_n)
Description
[center, U, obj_fcn] = fcm(data, cluster_n)
applies the fuzzy c-means clustering method to a given data set.
The input arguments of this function are:
data
: data set to be clustered; each row is a sample data pointcluster_n
: number of clusters (greater than one)The output arguments of this function are:
center
: matrix of final cluster centers where each row provides the center coordinatesU
: final fuzzy partition matrix (or membership function matrix) obj_fcn
: values of the objective function during iterationsfcm(data,cluster_n,options)
uses an additional argument variable, options
, to control clustering parameters, introduce a stopping criteria, and/or set the iteration information display.
options(1)
: exponent for the partition matrix U
(default: 2.0)
options(2)
: maximum number of iterations (default: 100)
If any entry of options
is NaN,
the default value for that option is used instead. The clustering process stops when the maximum number of iterations is reached, or when the objective function improvement between two consecutive iterations is less than the minimum amount of improvement specified.
Example
data = rand(100, 2); [center,U,obj_fcn] = fcm(data, 2); plot(data(:,1), data(:,2),'o'); maxU = max(U); index1 = find(U(1,:) == maxU); index2 = find(U(2, :) == maxU); line(data(index1,1), data(index1, 2), 'linestyle', 'none', 'marker', '*', 'color', 'g'); line(data(index2,1), data(index2, 2), 'linestyle', 'none', 'marker', '*', 'color', 'r');