#include <qgarlib/GenKMeans.H>
Definition at line 235 of file GenKMeans.H.
Public Types | |
Types | |
| typedef T | value_type |
| Type of the objects to be partitioned. | |
| typedef value_type & | reference |
| Reference to qgar::GenKMeans::value_type. | |
| typedef const value_type & | const_reference |
| Constant reference to qgar::GenKMeans::value_type. | |
| typedef value_type * | pointer |
| Pointer to qgar::GenKMeans::value_type. | |
| typedef const value_type * | const_pointer |
| Constant pointer to qgar::GenKMeans::value_type. | |
Signatures | |
| typedef double(* | DistanceFunction )(const_reference, const_reference) |
| Signature of the distance function. | |
Public Member Functions | |
Constructors | |
| GenKMeans (const std::vector< value_type > &anObjVect, DistanceFunction aDistFunction, int aClusterCnt=3) throw (qgar::QgarErrorAlgorithm) | |
| Construct a partition of clusters using a distance function. | |
| GenKMeans (const std::vector< value_type > &anObjVect, DistanceFunction aDistFunction, const std::vector< value_type > &aCenterVector, int aClusterCnt=3) throw (qgar::QgarErrorAlgorithm) | |
| Construct a partition of clusters of given centers, using a distance function. | |
Destructor | |
| ~GenKMeans () | |
| Destructor. | |
Access | |
| int | clusterCnt () const |
| Get number of resulting clusters. | |
| const std::vector< int > & | clusterSizes () const |
| Get the vector storing the resulting cluster sizes. | |
| const std::vector< const_pointer > & | clusterCenters () const |
| Get the vector storing the resulting cluster centers. | |
| const std::vector< std::vector< const_pointer > > & | accessClusterElts () const |
| Get the vector storing the elements of the clusters. | |
| std::vector< std::vector< const_pointer > > | clusterElts () const |
| Get a copy of the vector storing the elements of the clusters. | |
| const std::vector< GenCluster< value_type > > & | accessClusters () const |
| Get the vector storing the clusters. | |
| std::vector< GenCluster< value_type > > | clusters () const |
| Get a copy of the vector storing the clusters. | |
Protected Attributes | |
Representation of a cluster | |
| const int | _clusterCnt |
| Number of clusters. | |
| std::vector< std::vector< const_pointer > > | _clusterElts |
| Vector storing the values of the clusters. | |
| std::vector< int > | _clusterSizes |
| Vector of clusters sizes. | |
| std::vector< const_pointer > | _clusterCenters |
| Vector of cluster centers. | |
| std::vector< const_pointer > | _objVect |
| Vector of objects to be partitioned. | |
| std::vector< GenCluster< value_type > > | _clusters |
| Vector storing the final clusters. | |
| const DistanceFunction | _distance |
| The distance function. | |
Private Member Functions | |
Auxiliaries | |
| void | PRIVATEinitCenters () throw (qgar::QgarErrorAlgorithm) |
| Initialize cluster centers. | |
| void | PRIVATEdistributeIntoClusters () |
| Distribute objects into clusters. | |
| void | PRIVATEgetCenters (std::vector< const_pointer > &aNewCenterVector) throw (qgar::QgarErrorAlgorithm) |
| Compute new cluster centers. | |
| void | PRIVATEgetClusters () |
| Loop on constructing clusters until getting stable centers. | |
| void | PRIVATEconsFinalClusters () |
| Construct the final clusters in _clusters from _clustersElts. | |
Disabled | |
| GenKMeans (const GenKMeans &) | |
| Disabled copy constructor. | |
| GenKMeans & | operator= (const GenKMeans &) |
| Disabled assignment operator. | |
|
|||||
|
Constant pointer to qgar::GenKMeans::value_type.
Definition at line 269 of file GenKMeans.H. |
|
|||||
|
Constant reference to qgar::GenKMeans::value_type.
Definition at line 259 of file GenKMeans.H. |
|
|||||
|
Signature of the distance function.
Definition at line 281 of file GenKMeans.H. |
|
|||||
|
Pointer to qgar::GenKMeans::value_type.
Definition at line 264 of file GenKMeans.H. |
|
|||||
|
Reference to qgar::GenKMeans::value_type.
Definition at line 254 of file GenKMeans.H. |
|
|||||
|
Type of the objects to be partitioned.
Definition at line 249 of file GenKMeans.H. |
|
||||||||||||||||||||
|
Construct a partition of clusters using a distance function.
Definition at line 167 of file GenKMeans.TCC. |
|
||||||||||||||||||||||||
|
Construct a partition of clusters of given centers, using a distance function.
Definition at line 200 of file GenKMeans.TCC. |
|
|||||||||
|
Destructor. It is not virtual as the class is not supposed to be derived. Definition at line 234 of file GenKMeans.TCC. |
|
||||||||||
|
Disabled copy constructor.
|
|
|||||||||
|
Get the vector storing the elements of the clusters. Each element of the returned vector represents a cluster. Each cluster is itself represented by a vector, storing pointers to the elements of the cluster. Definition at line 279 of file GenKMeans.TCC. References qgar::GenKMeans< T >::_clusterElts. |
|
|||||||||
|
Get the vector storing the clusters. Each element of the returned vector represents a cluster. Each cluster is represented by an instance of class qgar::GenCluster. Definition at line 299 of file GenKMeans.TCC. References qgar::GenKMeans< T >::_clusters, and qgar::GenKMeans< T >::PRIVATEconsFinalClusters(). |
|
|||||||||
|
Get the vector storing the resulting cluster centers.
Definition at line 269 of file GenKMeans.TCC. References qgar::GenKMeans< T >::_clusterCenters. |
|
|||||||||
|
Get number of resulting clusters.
Definition at line 249 of file GenKMeans.TCC. References qgar::GenKMeans< T >::_clusterCnt. |
|
|||||||||
|
Get a copy of the vector storing the elements of the clusters. Each element of the returned vector represents a cluster. Each cluster is itself represented by a vector, storing pointers to the elements of the cluster. Definition at line 289 of file GenKMeans.TCC. References qgar::GenKMeans< T >::_clusterElts. |
|
|||||||||
|
Get a copy of the vector storing the clusters. Each element of the returned vector represents a cluster. Each cluster is represented by an instance of class qgar::GenCluster. Definition at line 310 of file GenKMeans.TCC. References qgar::GenKMeans< T >::_clusters, and qgar::GenKMeans< T >::PRIVATEconsFinalClusters(). |
|
|||||||||
|
Get the vector storing the resulting cluster sizes.
Definition at line 259 of file GenKMeans.TCC. References qgar::GenKMeans< T >::_clusterSizes. |
|
||||||||||
|
Disabled assignment operator.
|
|
|||||||||
|
Construct the final clusters in _clusters from _clustersElts.
Definition at line 552 of file GenKMeans.TCC. References qgar::GenKMeans< T >::_clusterCenters, qgar::GenKMeans< T >::_clusterElts, qgar::GenKMeans< T >::_clusters, and qgar::GenKMeans< T >::_clusterSizes. Referenced by qgar::GenKMeans< T >::accessClusters(), and qgar::GenKMeans< T >::clusters(). |
|
|||||||||
|
Distribute objects into clusters.
Definition at line 385 of file GenKMeans.TCC. References qgar::GenKMeans< T >::_clusterCenters, qgar::GenKMeans< T >::_clusterCnt, qgar::GenKMeans< T >::_clusterElts, qgar::GenKMeans< T >::_clusterSizes, and qgar::GenKMeans< T >::_objVect. Referenced by qgar::GenKMeans< T >::PRIVATEgetClusters(). |
|
||||||||||
|
Compute new cluster centers.
Referenced by qgar::GenKMeans< T >::PRIVATEgetClusters(). |
|
|||||||||
|
Loop on constructing clusters until getting stable centers.
Definition at line 493 of file GenKMeans.TCC. References qgar::GenKMeans< T >::_clusterCenters, qgar::GenKMeans< T >::_clusterElts, qgar::GenKMeans< T >::_clusterSizes, qgar::GenKMeans< T >::PRIVATEdistributeIntoClusters(), and qgar::GenKMeans< T >::PRIVATEgetCenters(). |
|
|||||||||
|
Initialize cluster centers. Use a given number of the first objects of the given list of objects.
Definition at line 327 of file GenKMeans.TCC. References qgar::GenKMeans< T >::_clusterCenters, qgar::GenKMeans< T >::_clusterCnt, qgar::GenKMeans< T >::_clusterSizes, qgar::GenKMeans< T >::_distance, qgar::GenKMeans< T >::_objVect, and qgar::qgEq0(). |
|
|||||
|
Vector of cluster centers.
Definition at line 438 of file GenKMeans.H. Referenced by qgar::GenKMeans< T >::clusterCenters(), qgar::GenKMeans< T >::PRIVATEconsFinalClusters(), qgar::GenKMeans< T >::PRIVATEdistributeIntoClusters(), qgar::GenKMeans< T >::PRIVATEgetClusters(), and qgar::GenKMeans< T >::PRIVATEinitCenters(). |
|
|||||
|
Number of clusters.
Definition at line 419 of file GenKMeans.H. Referenced by qgar::GenKMeans< T >::clusterCnt(), qgar::GenKMeans< T >::PRIVATEdistributeIntoClusters(), and qgar::GenKMeans< T >::PRIVATEinitCenters(). |
|
|||||
|
Vector storing the values of the clusters. Each element of this vector represents a cluster. Each cluster is also represented by a vector, storing the pointers to the elements of the cluster. Definition at line 428 of file GenKMeans.H. Referenced by qgar::GenKMeans< T >::accessClusterElts(), qgar::GenKMeans< T >::clusterElts(), qgar::GenKMeans< T >::PRIVATEconsFinalClusters(), qgar::GenKMeans< T >::PRIVATEdistributeIntoClusters(), and qgar::GenKMeans< T >::PRIVATEgetClusters(). |
|
|||||
|
Vector storing the final clusters. Each element of this vector represents a cluster. Each cluster is represented by an instance of class qgar::GenCluster. Definition at line 452 of file GenKMeans.H. Referenced by qgar::GenKMeans< T >::accessClusters(), qgar::GenKMeans< T >::clusters(), and qgar::GenKMeans< T >::PRIVATEconsFinalClusters(). |
|
|||||
|
Vector of clusters sizes.
Definition at line 433 of file GenKMeans.H. Referenced by qgar::GenKMeans< T >::clusterSizes(), qgar::GenKMeans< T >::PRIVATEconsFinalClusters(), qgar::GenKMeans< T >::PRIVATEdistributeIntoClusters(), qgar::GenKMeans< T >::PRIVATEgetClusters(), and qgar::GenKMeans< T >::PRIVATEinitCenters(). |
|
|||||
|
The distance function.
Definition at line 457 of file GenKMeans.H. Referenced by qgar::GenKMeans< T >::PRIVATEinitCenters(). |
|
|||||
|
Vector of objects to be partitioned.
Definition at line 443 of file GenKMeans.H. Referenced by qgar::GenKMeans< T >::PRIVATEdistributeIntoClusters(), and qgar::GenKMeans< T >::PRIVATEinitCenters(). |