mlpack
2.2.5

An algorithm for an exact Lloyd iteration which simply uses dualtree nearestneighbor search to find the nearest centroid for each point in the dataset. More...
Public Types  
template < typename TreeMetricType , typename IgnoredStatType , typename TreeMatType >  
using  NNSTreeType = TreeType< TreeMetricType, DualTreeKMeansStatistic, TreeMatType > 
typedef TreeType< MetricType, DualTreeKMeansStatistic, MatType >  Tree 
Convenience typedef. More...  
Public Member Functions  
DualTreeKMeans (const MatType &dataset, MetricType &metric)  
Construct the DualTreeKMeans object, which will construct a tree on the points. More...  
~DualTreeKMeans ()  
Delete the tree constructed by the DualTreeKMeans object. More...  
size_t  DistanceCalculations () const 
Return the number of distance calculations. More...  
size_t &  DistanceCalculations () 
Modify the number of distance calculations. More...  
double  Iterate (const arma::mat ¢roids, arma::mat &newCentroids, arma::Col< size_t > &counts) 
Run a single iteration of the dualtree nearest neighbor algorithm for kmeans, updating the given centroids into the newCentroids matrix. More...  
Detailed Description
template<typenameMetricType,typenameMatType,template<typenameTreeMetricType,typenameTreeStatType,typenameTreeMatType>classTreeType=tree::KDTree>
class mlpack::kmeans::DualTreeKMeans< MetricType, MatType, TreeType >
An algorithm for an exact Lloyd iteration which simply uses dualtree nearestneighbor search to find the nearest centroid for each point in the dataset.
The conditions under which this will perform best are probably limited to the case where k is close to the number of points in the dataset, and the number of iterations of the kmeans algorithm will be few.
Definition at line 41 of file dual_tree_kmeans.hpp.
Member Typedef Documentation
◆ NNSTreeType
using NNSTreeType = TreeType<TreeMetricType, DualTreeKMeansStatistic, TreeMatType> 
Definition at line 51 of file dual_tree_kmeans.hpp.
◆ Tree
typedef TreeType<MetricType, DualTreeKMeansStatistic, MatType> Tree 
Convenience typedef.
Definition at line 45 of file dual_tree_kmeans.hpp.
Constructor & Destructor Documentation
◆ DualTreeKMeans()
DualTreeKMeans  (  const MatType &  dataset, 
MetricType &  metric  
) 
Construct the DualTreeKMeans object, which will construct a tree on the points.
◆ ~DualTreeKMeans()
~DualTreeKMeans  (  ) 
Delete the tree constructed by the DualTreeKMeans object.
Member Function Documentation
◆ DistanceCalculations() [1/2]

inline 
Return the number of distance calculations.
Definition at line 77 of file dual_tree_kmeans.hpp.
◆ DistanceCalculations() [2/2]

inline 
Modify the number of distance calculations.
Definition at line 79 of file dual_tree_kmeans.hpp.
References mlpack::kmeans::HideChild(), and mlpack::kmeans::RestoreChildren().
◆ Iterate()
double Iterate  (  const arma::mat &  centroids, 
arma::mat &  newCentroids,  
arma::Col< size_t > &  counts  
) 
Run a single iteration of the dualtree nearest neighbor algorithm for kmeans, updating the given centroids into the newCentroids matrix.
 Parameters

centroids Current cluster centroids. newCentroids New cluster centroids. counts Current counts, to be overwritten with new counts.
The documentation for this class was generated from the following file:
 src/mlpack/methods/kmeans/dual_tree_kmeans.hpp
Generated by 1.8.13