latest version v1.9 - last update 10 Apr 2010 |
this class implements a k-means clustering that determines the number of clusters by itself More...
#include <ltiAdaptiveKMeans.h>
Classes | |
class | parameters |
the parameters for the class adaptiveKMeans More... | |
Public Member Functions | |
adaptiveKMeans () | |
adaptiveKMeans (const adaptiveKMeans &other) | |
virtual | ~adaptiveKMeans () |
virtual const char * | getTypeName () const |
adaptiveKMeans & | copy (const adaptiveKMeans &other) |
adaptiveKMeans & | operator= (const adaptiveKMeans &other) |
virtual classifier * | clone () const |
const parameters & | getParameters () const |
virtual bool | train (const dmatrix &input, ivector &ids) |
virtual bool | train (const dmatrix &input) |
this class implements a k-means clustering that determines the number of clusters by itself
The algorithm is based on Kothari R., Pitts D., 1998. On finding the number of clusters. Pattern Recognition Letters 20, 405-416.
The algorithm determines the number of cluster in the given data and performs a k means clustering the the detected number of clusters on it. When the algorithm is executed, is does a lot of k means clusterings, with an additional term that brings the cluster centers together. Clusters that have too few points are deleted and clusters that are two close to each other are combined, according to the actual neighborhood. The neighborhood is varied between the values of the parameters minNeighborhood and maxNeighborhood, in as many steps as parameter nbNeighborhoods. If parameter detectNeighborhood is true, the paramters minNeighborhood and maxNeighborhood are set by the algorithm.The Parameter minNumberOfPoints is the minimal number of points that must belong to a cluster, otherwise the cluster will be deleted. maxIterations is the maximum number of Iterations before the clusters are viewed to be stable. maxDistance is the maximal distance that each component of the centroids can move before they are viewed as stable. If every component moves in one iteration less than this parameter, the centroids are set to be stable. The Parameter nbClusters is the number of clusters the algorithm starts with. It has to be bigger than the real number clusters. If the learnRate is too big, so that the centroids don't converge, the algorithm halves the learn rate, restarts and sets a statusString.
lti::adaptiveKMeans::adaptiveKMeans | ( | ) |
default constructor
lti::adaptiveKMeans::adaptiveKMeans | ( | const adaptiveKMeans & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::adaptiveKMeans::~adaptiveKMeans | ( | ) | [virtual] |
destructor
virtual classifier* lti::adaptiveKMeans::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this clustering.
Implements lti::classifier.
adaptiveKMeans& lti::adaptiveKMeans::copy | ( | const adaptiveKMeans & | other | ) |
copy data of "other" clustering.
other | the clustering to be copied |
Reimplemented from lti::centroidClustering.
const parameters& lti::adaptiveKMeans::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::centroidClustering.
virtual const char* lti::adaptiveKMeans::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("adaptiveKMeans")
Reimplemented from lti::centroidClustering.
adaptiveKMeans& lti::adaptiveKMeans::operator= | ( | const adaptiveKMeans & | other | ) |
alias for copy member
other | the clustering to be copied |
Reimplemented from lti::classifier.
virtual bool lti::adaptiveKMeans::train | ( | const dmatrix & | input | ) | [virtual] |
Unsupervised training.
The vectors in the input
matrix will be clustered using each specific method.
Implements lti::centroidClustering.
Unsupervised training.
The vectors in the input
matrix will be put into groups according to the training algorithm. Additionally, an integer indicating the class each point belongs to is returned.
By default this method uses the other train method and then calls classify(const dvector&) to get the ids for each trainvector. These ids are then returned.
input | the matrix with the input vectors (each row is a training vector) | |
ids | vector of class ids for each input point |
Reimplemented from lti::centroidClustering.