wolffd@0: wolffd@0:
wolffd@0:wolffd@0: centres = kmeans(centres, data, options) wolffd@0: [centres, options] = kmeans(centres, data, options) wolffd@0: [centres, options, post, errlog] = kmeans(centres, data, options) wolffd@0:wolffd@0: wolffd@0: wolffd@0:
centres = kmeans(centres, data, options)
wolffd@0: uses the batch K-means algorithm to set the centres of a cluster model.
wolffd@0: The matrix data
represents the data
wolffd@0: which is being clustered, with each row corresponding to a vector.
wolffd@0: The sum of squares error function is used. The point at which
wolffd@0: a local minimum is achieved is returned as centres
. The
wolffd@0: error value at that point is returned in options(8)
.
wolffd@0:
wolffd@0: [centres, options, post, errlog] = kmeans(centres, data, options)
wolffd@0: also returns the cluster number (in a one-of-N encoding) for each data
wolffd@0: point in post
and a log of the error values after each cycle in
wolffd@0: errlog
.
wolffd@0:
wolffd@0: The optional parameters have the following interpretations.
wolffd@0:
wolffd@0:
options(1)
is set to 1 to display error values; also logs error
wolffd@0: values in the return argument errlog
.
wolffd@0: If options(1)
is set to 0,
wolffd@0: then only warning messages are displayed. If options(1)
is -1,
wolffd@0: then nothing is displayed.
wolffd@0:
wolffd@0:
options(2)
is a measure of the absolute precision required for the value
wolffd@0: of centres
at the solution. If the absolute difference between
wolffd@0: the values of centres
between two successive steps is less than
wolffd@0: options(2)
, then this condition is satisfied.
wolffd@0:
wolffd@0:
options(3)
is a measure of the precision required of the error
wolffd@0: function at the solution. If the absolute difference between the
wolffd@0: error functions between two successive steps is less than
wolffd@0: options(3)
, then this condition is satisfied.
wolffd@0: Both this and the previous condition must be
wolffd@0: satisfied for termination.
wolffd@0:
wolffd@0:
options(14)
is the maximum number of iterations; default 100.
wolffd@0:
wolffd@0:
kmeans
can be used to initialise the centres of a Gaussian
wolffd@0: mixture model that is then trained with the EM algorithm.
wolffd@0: wolffd@0: wolffd@0: [priors, centres, var] = gmmunpak(p, md); wolffd@0: centres = kmeans(centres, data, options); wolffd@0: p = gmmpak(priors, centres, var); wolffd@0: p = gmmem(p, md, data, options); wolffd@0:wolffd@0: wolffd@0: wolffd@0:
gmminit
, gmmem
Copyright (c) Ian T Nabney (1996-9) wolffd@0: wolffd@0: wolffd@0: wolffd@0: