Back to Adaptive Vision Library website
You are here: Start » Function Reference » Clustering » KMeansClustering
KMeansClustering
Clusters data using KMeans algorithm
Syntax
C++
C#
void avl::KMeansClustering ( const avl::Matrix& inData, const int inClusters, const int inMaxIterations, const int inSeed, const float inTerminationFactor, const avl::KMeansClusteringMethod::Type inClusteringMethod, avl::Matrix& outCentroids, atl::Array<int>& outPointToClusterAssignment, float& outDistanceSum )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
inData | const Matrix& | Data set, where variables are in columns and examples are in rows. | |||
inClusters | const int | 2 - + | 2 | Number of clusters to extract. | |
inMaxIterations | const int | 10 - 1000 | 200 | Maximal number of procedure iterations | |
inSeed | const int | 0 - | 5489 | Seed to init random engine. | |
inTerminationFactor | const float | 1.0 - 2.0 | 1.5f | Additional factor of procedure stop. | |
inClusteringMethod | const KMeansClusteringMethod::Type | KMeansPlusPlus | KMeans variant to use. | ||
outCentroids | Matrix& | Resulting centroid points in feature space. | |||
outPointToClusterAssignment | Array<int>& | Array of input point assignments to generated clusters. | |||
outDistanceSum | float& | Sum of squared distances from points to its respective cluster centroids. |
Errors
Error type | Description |
---|---|
DomainError | Empty dataset on input in KMeansClustering. |
DomainError | Cannot make more clusters than there is data in input dataset. |