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::SpectralClustering< KernelType > Class Template Reference
Inheritance diagram for ipsdk::math::clustering::SpectralClustering< KernelType >:

Public Types

typedef KernelKMeansClusteringConfig AlgorithmConfig
 algorithm configuration
 
typedef KernelKMeansClustering< KernelType > ClusteringAlgorithm
 clustering algorithm type
 
typedef boost::shared_ptr< ClusteringAlgorithmClusteringAlgorithmPtr
 shared pointer to clustering algorithm
 

Public Member Functions

const KernelType & getKernel () const
 retrieve kernel associated to object
 
void clear ()
 clear of processing results
 
Constructors and destructor
 SpectralClustering (const KernelType &kernel)
 
 ~SpectralClustering ()
 
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 getSeparation () const
 get separation associated to clustering result More...
 
ipUInt32 getNbIteration () const
 retrieve number of iterations associated to selected clustering solution More...
 
ipUInt32 getClusterPopulation (const ipUInt32 clusterIdx) const
 retrieve number of data associated to a given cluster More...
 
const UInt32VectorgetAssignments () const
 retrieve cluster index associated to each input data More...
 
const VectorgetEigenValues () const
 retrieve eigen values associated to spectral clustering More...
 
const MatrixgetEigenVectors () const
 retrieve eigen vectors associated to spectral clustering More...
 
ipUInt32 computeAssignment (const Vector &data) const
 function allowing to compute cluster assignment for a given data More...
 
const ClusteringAlgorithmgetClusteringAlgorithm () const
 retrieve underlying used clustering algorithm
 

Protected Attributes

ClusteringAlgorithmPtr _pClusteringAlgorithm
 underlying clustering algorithm
 
VectorColl _inputDataColl
 input data collection
 
UInt32Vector _assignments
 cluster index associated to each input data
 
Vector _eigenValues
 eigen values associated to eigen problem resolution
 
Matrix _eigenVectors
 eigen vectors associated to eigen problem resolution
 

Member Function Documentation

◆ compute()

template<typename KernelType>
bool ipsdk::math::clustering::SpectralClustering< KernelType >::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()

template<typename KernelType>
ipUInt32 ipsdk::math::clustering::SpectralClustering< KernelType >::getNbClusters ( ) const

retrieve number of clusters associated to clustering process

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

◆ getDataSize()

template<typename KernelType>
ipUInt32 ipsdk::math::clustering::SpectralClustering< KernelType >::getDataSize ( ) const

retrieve data size associated to input data collection

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

◆ getNbInputData()

template<typename KernelType>
ipUInt32 ipsdk::math::clustering::SpectralClustering< KernelType >::getNbInputData ( ) const

retrieve number of data in input data collection

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

◆ getInputDataColl()

template<typename KernelType>
const VectorColl& ipsdk::math::clustering::SpectralClustering< KernelType >::getInputDataColl ( ) const

retrieve used input data collection

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

◆ getNbFailedAttempts()

template<typename KernelType>
ipUInt32 ipsdk::math::clustering::SpectralClustering< KernelType >::getNbFailedAttempts ( ) const

retrieve number of failed attempts

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

◆ getSeparation()

template<typename KernelType>
ipReal64 ipsdk::math::clustering::SpectralClustering< KernelType >::getSeparation ( ) const

get separation associated to clustering result

separation is defined as the Dunn validity index

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

◆ getNbIteration()

template<typename KernelType>
ipUInt32 ipsdk::math::clustering::SpectralClustering< KernelType >::getNbIteration ( ) const

retrieve number of iterations associated to selected clustering solution

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

◆ getClusterPopulation()

template<typename KernelType>
ipUInt32 ipsdk::math::clustering::SpectralClustering< KernelType >::getClusterPopulation ( const ipUInt32  clusterIdx) const

retrieve number of data associated to a given cluster

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

◆ getAssignments()

template<typename KernelType>
const UInt32Vector& ipsdk::math::clustering::SpectralClustering< KernelType >::getAssignments ( ) const

retrieve cluster index associated to each input data

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

◆ getEigenValues()

template<typename KernelType>
const Vector& ipsdk::math::clustering::SpectralClustering< KernelType >::getEigenValues ( ) const

retrieve eigen values associated to spectral clustering

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

◆ getEigenVectors()

template<typename KernelType>
const Matrix& ipsdk::math::clustering::SpectralClustering< KernelType >::getEigenVectors ( ) const

retrieve eigen vectors associated to spectral clustering

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

◆ computeAssignment()

template<typename KernelType>
ipUInt32 ipsdk::math::clustering::SpectralClustering< KernelType >::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()
this assignment computation uses Nystrom approximation (see Sampling with Minimum Sum of Squared Similarities for Nystrom-Based Large Scale Spectral Clustering, Djallel Bouneffouf and Inanc Biro, Proceedings of the Twenty-Fourth IJCAI, International Joint Conference on Artificial Intelligence, 2015)

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