annotate toolboxes/FullBNT-1.0.7/nethelp3.3/kmeans.htm @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 <html>
wolffd@0 2 <head>
wolffd@0 3 <title>
wolffd@0 4 Netlab Reference Manual kmeans
wolffd@0 5 </title>
wolffd@0 6 </head>
wolffd@0 7 <body>
wolffd@0 8 <H1> kmeans
wolffd@0 9 </H1>
wolffd@0 10 <h2>
wolffd@0 11 Purpose
wolffd@0 12 </h2>
wolffd@0 13 Trains a k means cluster model.
wolffd@0 14
wolffd@0 15 <p><h2>
wolffd@0 16 Synopsis
wolffd@0 17 </h2>
wolffd@0 18 <PRE>
wolffd@0 19 centres = kmeans(centres, data, options)
wolffd@0 20 [centres, options] = kmeans(centres, data, options)
wolffd@0 21 [centres, options, post, errlog] = kmeans(centres, data, options)
wolffd@0 22 </PRE>
wolffd@0 23
wolffd@0 24
wolffd@0 25 <p><h2>
wolffd@0 26 Description
wolffd@0 27 </h2>
wolffd@0 28
wolffd@0 29 <CODE>centres = kmeans(centres, data, options)</CODE>
wolffd@0 30 uses the batch K-means algorithm to set the centres of a cluster model.
wolffd@0 31 The matrix <CODE>data</CODE> represents the data
wolffd@0 32 which is being clustered, with each row corresponding to a vector.
wolffd@0 33 The sum of squares error function is used. The point at which
wolffd@0 34 a local minimum is achieved is returned as <CODE>centres</CODE>. The
wolffd@0 35 error value at that point is returned in <CODE>options(8)</CODE>.
wolffd@0 36
wolffd@0 37 <p><CODE>[centres, options, post, errlog] = kmeans(centres, data, options)</CODE>
wolffd@0 38 also returns the cluster number (in a one-of-N encoding) for each data
wolffd@0 39 point in <CODE>post</CODE> and a log of the error values after each cycle in
wolffd@0 40 <CODE>errlog</CODE>.
wolffd@0 41
wolffd@0 42 The optional parameters have the following interpretations.
wolffd@0 43
wolffd@0 44 <p><CODE>options(1)</CODE> is set to 1 to display error values; also logs error
wolffd@0 45 values in the return argument <CODE>errlog</CODE>.
wolffd@0 46 If <CODE>options(1)</CODE> is set to 0,
wolffd@0 47 then only warning messages are displayed. If <CODE>options(1)</CODE> is -1,
wolffd@0 48 then nothing is displayed.
wolffd@0 49
wolffd@0 50 <p><CODE>options(2)</CODE> is a measure of the absolute precision required for the value
wolffd@0 51 of <CODE>centres</CODE> at the solution. If the absolute difference between
wolffd@0 52 the values of <CODE>centres</CODE> between two successive steps is less than
wolffd@0 53 <CODE>options(2)</CODE>, then this condition is satisfied.
wolffd@0 54
wolffd@0 55 <p><CODE>options(3)</CODE> is a measure of the precision required of the error
wolffd@0 56 function at the solution. If the absolute difference between the
wolffd@0 57 error functions between two successive steps is less than
wolffd@0 58 <CODE>options(3)</CODE>, then this condition is satisfied.
wolffd@0 59 Both this and the previous condition must be
wolffd@0 60 satisfied for termination.
wolffd@0 61
wolffd@0 62 <p><CODE>options(14)</CODE> is the maximum number of iterations; default 100.
wolffd@0 63
wolffd@0 64 <p><h2>
wolffd@0 65 Example
wolffd@0 66 </h2>
wolffd@0 67 <CODE>kmeans</CODE> can be used to initialise the centres of a Gaussian
wolffd@0 68 mixture model that is then trained with the EM algorithm.
wolffd@0 69 <PRE>
wolffd@0 70
wolffd@0 71 [priors, centres, var] = gmmunpak(p, md);
wolffd@0 72 centres = kmeans(centres, data, options);
wolffd@0 73 p = gmmpak(priors, centres, var);
wolffd@0 74 p = gmmem(p, md, data, options);
wolffd@0 75 </PRE>
wolffd@0 76
wolffd@0 77
wolffd@0 78 <p><h2>
wolffd@0 79 See Also
wolffd@0 80 </h2>
wolffd@0 81 <CODE><a href="gmminit.htm">gmminit</a></CODE>, <CODE><a href="gmmem.htm">gmmem</a></CODE><hr>
wolffd@0 82 <b>Pages:</b>
wolffd@0 83 <a href="index.htm">Index</a>
wolffd@0 84 <hr>
wolffd@0 85 <p>Copyright (c) Ian T Nabney (1996-9)
wolffd@0 86
wolffd@0 87
wolffd@0 88 </body>
wolffd@0 89 </html>