LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::kMeansClustering Class Reference

This class implements two versions of k-means-clustering: batch and sequential. More...

#include <ltiKMeansClustering.h>

Inheritance diagram for lti::kMeansClustering:
Inheritance graph
[legend]
Collaboration diagram for lti::kMeansClustering:
Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 Parameters for kMeansClustering. More...

Public Member Functions

 kMeansClustering ()
 kMeansClustering (const kMeansClustering &other)
virtual ~kMeansClustering ()
virtual const char * getTypeName () const
kMeansClusteringcopy (const kMeansClustering &other)
virtual classifierclone () const
const parametersgetParameters () const
virtual bool train (const dmatrix &data)
virtual bool train (const dmatrix &input, ivector &ids)

Protected Member Functions

bool trainBatch (const dmatrix &data)
bool trainSequential (const dmatrix &data)

Detailed Description

This class implements two versions of k-means-clustering: batch and sequential.

Both methods are initailized by drawing numberOfClusters training points and assigning them as centroids. The batch version continues by labeling each training point with the centroid it belongs to and then calculating new centroids as mean average of the data belonging to each cluster. This is continued until a convergence criterion is met.

The sequential algorithm performs one step of batch training. After that training points are analyzed in random order. Whenever one data point switches clusters the centroids of the old and new cluster of that data point are recalculated. Calculation is also stoped by a convergence criterion.

For both methods the convergence criterion is that for one run through the training set none of the training points switched clusters.


Constructor & Destructor Documentation

lti::kMeansClustering::kMeansClustering (  ) 

default constructor

lti::kMeansClustering::kMeansClustering ( const kMeansClustering other  ) 

copy constructor

Parameters:
other the object to be copied
virtual lti::kMeansClustering::~kMeansClustering (  )  [virtual]

destructor


Member Function Documentation

virtual classifier* lti::kMeansClustering::clone (  )  const [virtual]

returns a pointer to a clone of this classifier.

Implements lti::classifier.

kMeansClustering& lti::kMeansClustering::copy ( const kMeansClustering other  ) 

copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::centroidClustering.

const parameters& lti::kMeansClustering::getParameters (  )  const

returns used parameters

Reimplemented from lti::centroidClustering.

virtual const char* lti::kMeansClustering::getTypeName (  )  const [virtual]

returns the name of this type ("kMeansClustering")

Reimplemented from lti::centroidClustering.

virtual bool lti::kMeansClustering::train ( const dmatrix input,
ivector ids 
) [virtual]
virtual bool lti::kMeansClustering::train ( const dmatrix data  )  [virtual]

Performs batch or sequential training according to the value of parameters::clusterMode.

Parameters:
data the training points

Implements lti::centroidClustering.

bool lti::kMeansClustering::trainBatch ( const dmatrix data  )  [protected]

returns current parameters.

(non const! -> protected) Performs batch k-means clustering, see class description.

bool lti::kMeansClustering::trainSequential ( const dmatrix data  )  [protected]

Performs sequential k-means clustering, see class description.


The documentation for this class was generated from the following file:

Generated on Sat Apr 10 15:26:52 2010 for LTI-Lib by Doxygen 1.6.1