IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
SpectralClustering.h
1 // SpectralClustering.h:
3 // ---------------------
4 //
29 
30 #ifndef __IPSDKMATH_SPECTRALCLUSTERING_H__
31 #define __IPSDKMATH_SPECTRALCLUSTERING_H__
32 
33 // suppression warnings
34 // warning C4251: 'ipsdk::math::clustering::SpectralClustering<KernelType>::_pClusteringAlgorithm': class 'boost::shared_ptr<ipsdk::math::clustering::KernelKMeansClustering<KernelType>>' needs to have dll-interface to be used by clients of class 'ipsdk::math::clustering::SpectralClustering<KernelType>'
35 // warning C4275: interface non dll class 'boost::noncopyable_::noncopyable' utilisée comme base d'une interface dll class 'ipsdk::math::clustering::SpectralClustering<KernelType>'
36 #pragma warning (push)
37 #pragma warning (disable : 4275 4251)
38 
41 #include <IPSDKMath/Clustering/KernelKMeansClusteringConfig.h>
42 #include <boost/noncopyable.hpp>
43 
44 namespace ipsdk {
45 namespace math {
46 namespace clustering {
47 
50 
51 template <typename KernelType>
52 class IPSDKMATH_API SpectralClustering : public boost::noncopyable
53 {
54 // predefined public types
55 public:
58 
61 
63  typedef boost::shared_ptr<ClusteringAlgorithm> ClusteringAlgorithmPtr;
64 
65 public:
68  SpectralClustering(const KernelType& kernel);
71 
72 // methods
73 public:
75  const KernelType& getKernel() const;
76 
79  const AlgorithmConfig& getConfig() const;
80  void setConfig(const AlgorithmConfig& config);
82 
83  // ----------------------------
86  // ----------------------------
87 
89  bool isClusteringDone() const;
90 
114  bool compute(const ipUInt32 nbClusters,
115  const VectorColl& inputDataColl);
117 
118  // ------------------------
121  // ------------------------
122 
126  ipUInt32 getNbClusters() const;
127 
131  ipUInt32 getDataSize() const;
132 
136  ipUInt32 getNbInputData() const;
137 
141  const VectorColl& getInputDataColl() const;
142 
146  ipUInt32 getNbFailedAttempts() const;
147 
153  ipReal64 getSeparation() const;
154 
159  ipUInt32 getNbIteration() const;
160 
164  ipUInt32 getClusterPopulation(const ipUInt32 clusterIdx) const;
165 
169  const UInt32Vector& getAssignments() const;
170 
174  const Vector& getEigenValues() const;
175 
179  const Matrix& getEigenVectors() const;
180 
191  ipUInt32 computeAssignment(const Vector& data) const;
192 
194  const ClusteringAlgorithm& getClusteringAlgorithm() const;
196 
198  void clear();
199 
200 // attributes
201 protected:
204 
207 
210 
213 
216 };
217 
220 
221 } // end of namespace clustering
222 } // end of namespace math
223 } // end of namespace ipsdk
224 
225 #pragma warning (pop)
226 
227 #endif // __IPSDKMATH_SPECTRALCLUSTERING_H__
Definition of import/export macro for library.
boost::numeric::ublas::matrix< ipReal64 > Matrix
matrix type associated to library
Definition: LinearAlgebraTypes.h:48
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
KernelKMeansClustering< KernelType > ClusteringAlgorithm
clustering algorithm type
Definition: SpectralClustering.h:60
std::vector< ipUInt32 > UInt32Vector
stl vector collections
Definition: BaseCollections.h:33
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
Definition: KernelKMeansClusteringConfig.h:29
boost::shared_ptr< ClusteringAlgorithm > ClusteringAlgorithmPtr
shared pointer to clustering algorithm
Definition: SpectralClustering.h:63
ClusteringAlgorithmPtr _pClusteringAlgorithm
underlying clustering algorithm
Definition: SpectralClustering.h:203
Definition: ClusteringTypes.h:31
VectorColl _inputDataColl
input data collection
Definition: SpectralClustering.h:206
boost::numeric::ublas::vector< ipReal64 > Vector
vector type associated to library
Definition: LinearAlgebraTypes.h:36
std::vector< Vector > VectorColl
collection of vectors
Definition: ClusteringTypes.h:31
Vector _eigenValues
eigen values associated to eigen problem resolution
Definition: SpectralClustering.h:212
#define IPSDKMATH_API
Import/Export macro for library IPSDKMath.
Definition: IPSDKMathExports.h:27
KernelKMeansClusteringConfig AlgorithmConfig
algorithm configuration
Definition: SpectralClustering.h:57
UInt32Vector _assignments
cluster index associated to each input data
Definition: SpectralClustering.h:209
Matrix _eigenVectors
eigen vectors associated to eigen problem resolution
Definition: SpectralClustering.h:215
IPSDKMATH_API ipUInt32 computeAssignment(const VectorColl &clustersCentersColl, const Vector &data)
function allowing to compute cluster assignment using an euclidian distance to clusters centers ...
Predefined types for clustering algorithm.
Definition: ClusteringTypes.h:29
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53