prtClusterKmeans Kmeans clustering object
CLUSTER = prtClusterKmeans returns a Kmeans clustering object.
CLUSTER = prtClusterKmeans(PROPERTY1, VALUE1, ...) constructs a
prtClassFld object CLASSIFIER with properties as specified by
PROPERTY/VALUE pairs.
A prtClusterKmeans object inherits all properties from the abstract
class prtCluster. In addition is has the following properties:
nClusters - Number of cluster centers to learn
kmeansHandleEmptyClusters - Speficies operation when degerate clusters found
occur during training. Allowed values are 'remove'
and 'random'. 'remove' eliminates the
empty cluster. 'random' sets the
cluster mean to a random vector.
For information on the K-Means algorithm, please
refer to the following URL:
http://en.wikipedia.org/wiki/K-means_clustering
A prtClusterKmeans object inherits the TRAIN, RUN, CROSSVALIDATE and
KFOLDS methods from prtAction. It also inherits the PLOT method from
prtCluster.
Invoking the RUN method on a prtClusterKmeans object classifies
the input data by assigning each observation a label according to
the cluster center it is closest to. The cluster centers are found
during training.
Example:
ds = prtDataGenMary % Load a prtDataSet
clusterAlgo = prtClusterKmeans; % Create a prtClusterKmeans object
clusterAlgo.nClusters = 3; % Set the number of desired clusters
% Set the internal decision rule to be MAP. Not required for
% clustering, but necessary to plot the results.
clusterAlgo.internalDecider = prtDecisionMap;
clusterAlgo = clusterAlgo.train(ds); % Train the cluster algorithm
plot(clusterAlgo); % Plot the results