mlpack
Public Member Functions | Static Public Member Functions | List of all members
mlpack::kmeans::AllowEmptyClusters Class Reference

Policy which allows K-Means to create empty clusters without any error being reported. More...

#include <allow_empty_clusters.hpp>

Public Member Functions

 AllowEmptyClusters ()
 Default constructor required by EmptyClusterPolicy policy.
 
template<typename Archive >
void serialize (Archive &, const uint32_t)
 Serialize the empty cluster policy (nothing to do).
 

Static Public Member Functions

template<typename MetricType , typename MatType >
static force_inline void EmptyCluster (const MatType &, const size_t emptyCluster, const arma::mat &oldCentroids, arma::mat &newCentroids, arma::Col< size_t > &, MetricType &, const size_t)
 This function allows empty clusters to persist simply by leaving the empty cluster in its last position. More...
 

Detailed Description

Policy which allows K-Means to create empty clusters without any error being reported.

Member Function Documentation

◆ EmptyCluster()

template<typename MetricType , typename MatType >
static force_inline void mlpack::kmeans::AllowEmptyClusters::EmptyCluster ( const MatType &  ,
const size_t  emptyCluster,
const arma::mat &  oldCentroids,
arma::mat &  newCentroids,
arma::Col< size_t > &  ,
MetricType &  ,
const size_t   
)
inlinestatic

This function allows empty clusters to persist simply by leaving the empty cluster in its last position.

Template Parameters
MatTypeType of data (arma::mat or arma::spmat).
Parameters
*(data) Dataset on which clustering is being performed.
emptyClusterIndex of cluster which is empty.
oldCentroidsCentroids of each cluster (one per column) at the start of the iteration.
newCentroidsCentroids of each cluster (one per column) at the end of the iteration.
*(clusterCounts) Number of points in each cluster.
*(metric) The Metric to use.
*(iteration) Number of iteration.
Returns
Number of points changed (0).

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