mlpack 3.4.2
Public Member Functions | Static Public Member Functions | List of all members
KillEmptyClusters Class Reference

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

#include <kill_empty_clusters.hpp>

Public Member Functions

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

Static Public Member Functions

template<typename MetricType , typename MatType >
static force_inline void EmptyCluster (const MatType &, const size_t emptyCluster, const arma::mat &, arma::mat &newCentroids, arma::Col< size_t > &clusterCounts, MetricType &, const size_t)
 This function sets an empty cluster found during k-means to all DBL_MAX (i.e. More...
 

Detailed Description

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

This means the centroids will be filled with DBL_MAX.

Definition at line 25 of file kill_empty_clusters.hpp.

Constructor & Destructor Documentation

◆ KillEmptyClusters()

KillEmptyClusters ( )
inline

Default constructor required by EmptyClusterPolicy policy.

Definition at line 29 of file kill_empty_clusters.hpp.

Member Function Documentation

◆ EmptyCluster()

static force_inline void EmptyCluster ( const MatType &  ,
const size_t  emptyCluster,
const arma::mat &  ,
arma::mat &  newCentroids,
arma::Col< size_t > &  clusterCounts,
MetricType &  ,
const  size_t 
)
inlinestatic

This function sets an empty cluster found during k-means to all DBL_MAX (i.e.

an invalid "dead" cluster).

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.
*(oldCentroids) Centroids 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.
clusterCountsNumber of points in each cluster.
*(metric) The Metric to use.
*(iteration) Number of iteration.
Returns
Number of points changed (0).

Definition at line 49 of file kill_empty_clusters.hpp.

◆ serialize()

void serialize ( Archive &  ,
const unsigned int   
)
inline

Serialize the empty cluster policy (nothing to do).

Definition at line 68 of file kill_empty_clusters.hpp.


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