IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Public Types | Public Member Functions | Protected Attributes | List of all members
ipsdk::math::clustering::KMeansClustering Class Reference
Inheritance diagram for ipsdk::math::clustering::KMeansClustering:

Public Types

typedef KMeansClusteringConfig AlgorithmConfig
 algorithm configuration
 

Public Member Functions

void clear ()
 clear of processing results
 
Constructors and destructor
 KMeansClustering ()
 
 ~KMeansClustering ()
 
const AlgorithmConfiggetConfig () const
 access to algorithm configuration
 
void setConfig (const AlgorithmConfig &config)
 access to algorithm configuration
 
Algorithm computation
bool isClusteringDone () const
 check whether a computation has been done
 
bool compute (const ipUInt32 nbClusters, const VectorColl &inputDataColl)
 proceed to data clustering More...
 
Algorithm results
ipUInt32 getNbClusters () const
 retrieve number of clusters associated to clustering process More...
 
ipUInt32 getDataSize () const
 retrieve data size associated to input data collection More...
 
ipUInt32 getNbInputData () const
 retrieve number of data in input data collection More...
 
const VectorCollgetInputDataColl () const
 retrieve used input data collection More...
 
ipUInt32 getNbFailedAttempts () const
 retrieve number of failed attempts More...
 
ipReal64 getCompactness () const
 get compactness associated to clustering result More...
 
ipUInt32 getNbIteration () const
 retrieve number of iterations associated to selected clustering solution More...
 
ipReal64 computeValidityIndex (const eValidityIndexType &validityIndexType) const
 compute a validity index associated to clustering result More...
 
const VectorCollgetClustersCenters () const
 retrieve collection of computed clusters centers More...
 
ipUInt32 getClusterPopulation (const ipUInt32 clusterIdx) const
 retrieve number of data associated to a given cluster More...
 
const VectorgetClusterCenter (const ipUInt32 clusterIdx) const
 retrieve center for a given cluster More...
 
ipReal64 getClusterStdDev (const ipUInt32 clusterIdx) const
 retrieve standard deviation for a given cluster More...
 
const UInt32VectorgetAssignments () const
 retrieve cluster index associated to each input data More...
 
ipUInt32 computeAssignment (const Vector &data) const
 function allowing to compute cluster assignment for a given data More...
 

Protected Attributes

AlgorithmConfig _config
 configuration associated to clustering algorithm
 
VectorColl _inputDataColl
 input data collection
 
ipUInt32 _nbFailedAttempts
 number of failed attempts
 
ipUInt32 _nbIteration
 number of iterations associated to selected clustering solution
 
ipReal64 _compactness
 compactness associated to processing
 
VectorColl _clustersCenters
 cluster centers associated to processing
 
UInt32Vector _assignments
 cluster index associated to each input data
 

Member Function Documentation

◆ compute()

bool ipsdk::math::clustering::KMeansClustering::compute ( const ipUInt32  nbClusters,
const VectorColl inputDataColl 
)

proceed to data clustering

getNbAttempts() of K-Means++ algorithm will be used to initialize K-Means algorithm.

For a given attempt, if process reach maximum number of iterations (getConfig().getNbMaxIteration()) before that clusters centers stabilization is reached, current attempt is considered as failed

If none of the getNbAttempts() succeed, algorithm is considered on failure

On output clusters are sorted in decreasing population order

Parameters
nbClustersnumber of searched clusters
inputDataCollcollection of observations
Returns
false if no attempt succeed
Exceptions
ipsdk::math::IPSDKMathExceptionif nbClusters == 0
ipsdk::math::IPSDKMathExceptionif nbClusters > inputDataColl.size()
Warning
there is no check to ensure that inputDataColl[i].size() == inputDataColl[0].size()

◆ getNbClusters()

ipUInt32 ipsdk::math::clustering::KMeansClustering::getNbClusters ( ) const

retrieve number of clusters associated to clustering process

Exceptions
ipsdk::math::IPSDKMathExceptionif isClusteringDone() == false

◆ getDataSize()

ipUInt32 ipsdk::math::clustering::KMeansClustering::getDataSize ( ) const

retrieve data size associated to input data collection

Exceptions
ipsdk::math::IPSDKMathExceptionif isClusteringDone() == false

◆ getNbInputData()

ipUInt32 ipsdk::math::clustering::KMeansClustering::getNbInputData ( ) const

retrieve number of data in input data collection

Exceptions
ipsdk::math::IPSDKMathExceptionif isClusteringDone() == false

◆ getInputDataColl()

const VectorColl& ipsdk::math::clustering::KMeansClustering::getInputDataColl ( ) const

retrieve used input data collection

Exceptions
ipsdk::math::IPSDKMathExceptionif isClusteringDone() == false

◆ getNbFailedAttempts()

ipUInt32 ipsdk::math::clustering::KMeansClustering::getNbFailedAttempts ( ) const

retrieve number of failed attempts

Exceptions
ipsdk::math::IPSDKMathExceptionif isClusteringDone() == false

◆ getCompactness()

ipReal64 ipsdk::math::clustering::KMeansClustering::getCompactness ( ) const

get compactness associated to clustering result

compactness is the sum of squares of distances between input data and center of their associated cluster

Exceptions
ipsdk::math::IPSDKMathExceptionif isClusteringDone() == false

◆ getNbIteration()

ipUInt32 ipsdk::math::clustering::KMeansClustering::getNbIteration ( ) const

retrieve number of iterations associated to selected clustering solution

Exceptions
ipsdk::math::IPSDKMathExceptionif isClusteringDone() == false

◆ computeValidityIndex()

ipReal64 ipsdk::math::clustering::KMeansClustering::computeValidityIndex ( const eValidityIndexType validityIndexType) const

compute a validity index associated to clustering result

Exceptions
ipsdk::math::IPSDKMathExceptionif isClusteringDone() == false

◆ getClustersCenters()

const VectorColl& ipsdk::math::clustering::KMeansClustering::getClustersCenters ( ) const

retrieve collection of computed clusters centers

Exceptions
ipsdk::math::IPSDKMathExceptionif isClusteringDone() == false

◆ getClusterPopulation()

ipUInt32 ipsdk::math::clustering::KMeansClustering::getClusterPopulation ( const ipUInt32  clusterIdx) const

retrieve number of data associated to a given cluster

Exceptions
ipsdk::math::IPSDKMathExceptionif clusterIdx >= getNbClusters()

◆ getClusterCenter()

const Vector& ipsdk::math::clustering::KMeansClustering::getClusterCenter ( const ipUInt32  clusterIdx) const

retrieve center for a given cluster

Exceptions
ipsdk::math::IPSDKMathExceptionif clusterIdx >= getNbClusters()

◆ getClusterStdDev()

ipReal64 ipsdk::math::clustering::KMeansClustering::getClusterStdDev ( const ipUInt32  clusterIdx) const

retrieve standard deviation for a given cluster

Exceptions
ipsdk::math::IPSDKMathExceptionif clusterIdx >= getNbClusters()

◆ getAssignments()

const UInt32Vector& ipsdk::math::clustering::KMeansClustering::getAssignments ( ) const

retrieve cluster index associated to each input data

Exceptions
ipsdk::math::IPSDKMathExceptionif isClusteringDone() == false

◆ computeAssignment()

ipUInt32 ipsdk::math::clustering::KMeansClustering::computeAssignment ( const Vector data) const

function allowing to compute cluster assignment for a given data

Exceptions
ipsdk::math::IPSDKMathExceptionif isClusteringDone() == false
Warning
there is no check to ensure that data.size() == getDataSize()

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