|
| | KMeans (int numCenters=0) |
| | constructor with optionally given number of centers More...
|
| |
| void | init (int numCenters) |
| | deferred intitialization with number of centers More...
|
| |
| int | findNN (const Vector &v, Scalar &minDist) |
| | finds the nearest centroid for a given data pointer More...
|
| |
| template<class RandomAcessIterator > |
| Result | apply (RandomAcessIterator begin, RandomAcessIterator end, int numSteps=1000, bool reinitCenters=true) |
| | runs the KMeans algorithms on the given data More...
|
| |
template<class Vector, class Scalar>
class icl::math::KMeans< Vector, Scalar >
Generic Implementation of the K-Means algorithm.
The K-Means algorithms performs vector quantisation in a very simple way. Given a set of data pointers xi, and starting with a fixed given number of initial centroids, randomly drawn from the given data points, it iterates two steps:
- assign each data point to it's closest centroid (winnter takes all association)
- move centroids to the mean of it's associated data points
Vector Types
Supported Vector Types are FixedColVector, FixedRowVector, DynColVector, DynRowVector and Point32f
template<class Vector , class Scalar >
template<class RandomAcessIterator >
| Result icl::math::KMeans< Vector, Scalar >::apply |
( |
RandomAcessIterator |
begin, |
|
|
RandomAcessIterator |
end, |
|
|
int |
numSteps = 1000, |
|
|
bool |
reinitCenters = true |
|
) |
| |
|
inline |
runs the KMeans algorithms on the given data
if reinitCenters is set to false, the centers of the last call to this method are reused