| 
    mlpack
    master
    
   | 
 
The rules class for the single-tree Pelleg-Moore kd-tree traversal for k-means clustering. More...
Public Member Functions | |
| PellegMooreKMeansRules (const typename TreeType::Mat &dataset, const arma::mat ¢roids, arma::mat &newCentroids, arma::Col< size_t > &counts, MetricType &metric) | |
| Create the PellegMooreKMeansRules object.  More... | |
| double | BaseCase (const size_t queryIndex, const size_t referenceIndex) | 
| The BaseCase() function for this single-tree algorithm does nothing.  More... | |
| size_t | DistanceCalculations () const | 
| Get the number of distance calculations that have been performed.  More... | |
| size_t & | DistanceCalculations () | 
| Modify the number of distance calculations that have been performed.  More... | |
| double | Rescore (const size_t queryIndex, TreeType &referenceNode, const double oldScore) | 
| Rescore to determine if a node can be pruned.  More... | |
| double | Score (const size_t queryIndex, TreeType &referenceNode) | 
| Determine if a cluster can be pruned, and if not, perform point-to-cluster comparisons.  More... | |
Private Attributes | |
| const arma::mat & | centroids | 
| The clusters.  More... | |
| arma::Col< size_t > & | counts | 
| The counts of points in each cluster.  More... | |
| const TreeType::Mat & | dataset | 
| The dataset.  More... | |
| size_t | distanceCalculations | 
| The number of O(d) distance calculations that have been performed.  More... | |
| MetricType & | metric | 
| Instantiated metric.  More... | |
| arma::mat & | newCentroids | 
| The new centroids.  More... | |
The rules class for the single-tree Pelleg-Moore kd-tree traversal for k-means clustering.
Although TreeType is a free template parameter, this particular implementation is specialized to trees with hyper-rectangle bounds due to the pruning rule used to determine if one cluster dominates a node with respect to another cluster.
Our implementation here abuses the single-tree algorithm abstractions a little bit. Instead of doing a traversal for a particular query point, in this case we consider all clusters at once—so the query point is entirely ignored during in BaseCase() and Score().
Definition at line 33 of file pelleg_moore_kmeans_rules.hpp.
| mlpack::kmeans::PellegMooreKMeansRules< MetricType, TreeType >::PellegMooreKMeansRules | ( | const typename TreeType::Mat & | dataset, | 
| const arma::mat & | centroids, | ||
| arma::mat & | newCentroids, | ||
| arma::Col< size_t > & | counts, | ||
| MetricType & | metric | ||
| ) | 
Create the PellegMooreKMeansRules object.
| dataset | The dataset that the tree is built on. | 
| centroids | The current centroids. | 
| newCentroids | New centroids after this iteration (output). | 
| counts | Current cluster counts, to be replaced with new cluster counts. | 
| metric | Instantiated metric. | 
| double mlpack::kmeans::PellegMooreKMeansRules< MetricType, TreeType >::BaseCase | ( | const size_t | queryIndex, | 
| const size_t | referenceIndex | ||
| ) | 
The BaseCase() function for this single-tree algorithm does nothing.
Instead, point-to-cluster comparisons are handled as necessary in Score().
| queryIndex | Index of query point (fake, will be ignored). | 
| referenceIndex | Index of reference point. | 
      
  | 
  inline | 
Get the number of distance calculations that have been performed.
Definition at line 84 of file pelleg_moore_kmeans_rules.hpp.
References mlpack::kmeans::PellegMooreKMeansRules< MetricType, TreeType >::distanceCalculations.
      
  | 
  inline | 
Modify the number of distance calculations that have been performed.
Definition at line 86 of file pelleg_moore_kmeans_rules.hpp.
References mlpack::kmeans::PellegMooreKMeansRules< MetricType, TreeType >::distanceCalculations.
| double mlpack::kmeans::PellegMooreKMeansRules< MetricType, TreeType >::Rescore | ( | const size_t | queryIndex, | 
| TreeType & | referenceNode, | ||
| const double | oldScore | ||
| ) | 
Rescore to determine if a node can be pruned.
In this case, a node can never be pruned during rescoring, so this just returns oldScore.
| queryIndex | Index of query point (fake, will be ignored). | 
| referenceNode | Node containing points in the dataset. | 
| oldScore | Resulting score from Score(). | 
| double mlpack::kmeans::PellegMooreKMeansRules< MetricType, TreeType >::Score | ( | const size_t | queryIndex, | 
| TreeType & | referenceNode | ||
| ) | 
Determine if a cluster can be pruned, and if not, perform point-to-cluster comparisons.
The point-to-cluster comparisons are performed here and not in BaseCase() because of the complexity of managing the blacklist.
| queryIndex | Index of query point (fake, will be ignored). | 
| referenceNode | Node containing points in the dataset. | 
      
  | 
  private | 
The clusters.
Definition at line 92 of file pelleg_moore_kmeans_rules.hpp.
      
  | 
  private | 
The counts of points in each cluster.
Definition at line 96 of file pelleg_moore_kmeans_rules.hpp.
      
  | 
  private | 
The dataset.
Definition at line 90 of file pelleg_moore_kmeans_rules.hpp.
      
  | 
  private | 
The number of O(d) distance calculations that have been performed.
Definition at line 101 of file pelleg_moore_kmeans_rules.hpp.
Referenced by mlpack::kmeans::PellegMooreKMeansRules< MetricType, TreeType >::DistanceCalculations().
      
  | 
  private | 
Instantiated metric.
Definition at line 98 of file pelleg_moore_kmeans_rules.hpp.
      
  | 
  private | 
The new centroids.
Definition at line 94 of file pelleg_moore_kmeans_rules.hpp.
 1.8.11