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