Back to FabImage Library website
You are here: Start » Function Reference » Data Classification » Clustering » ClusterData_KMeans

ClusterData_KMeans
Header: | FIL.h |
---|---|
Namespace: | fil |
Module: | FoundationPro |
Clusters data using KMeans algorithm.
Syntax
C++
C#
void fil::ClusterData_KMeans ( const ftl::Array<ftl::Array<float> >& inData, const int inClusters, const int inMaxIterations, const int inSeed, const float inTerminationFactor, const fil::KMeansClusteringMethod::Type inClusteringMethod, fil::Matrix& outCentroids, ftl::Array<int>& outPointToClusterAssignment, float& outDistanceSum )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() |
inData | const Array<Array<float> >& | Data set, array of examples | ||
![]() |
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
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Cannot make more clusters than there is data in input dataset in ClusterData_KMeans. |
DomainError | Empty dataset on input in ClusterData_KMeans. |
DomainError | Inconsistent number of data coordinates in input dataset in ClusterData_KMeans. |