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

When an empty cluster is detected, this class takes the point furthest from the centroid of the cluster with maximum variance as a new cluster. More...

#include <max_variance_new_cluster.hpp>

Public Member Functions

 MaxVarianceNewCluster ()
 Default constructor required by EmptyClusterPolicy.
 
template<typename MetricType , typename MatType >
void EmptyCluster (const MatType &data, const size_t emptyCluster, const arma::mat &oldCentroids, arma::mat &newCentroids, arma::Col< size_t > &clusterCounts, MetricType &metric, const size_t iteration)
 Take the point furthest from the centroid of the cluster with maximum variance to be a new cluster. More...
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t version)
 Serialize the object.
 

Detailed Description

When an empty cluster is detected, this class takes the point furthest from the centroid of the cluster with maximum variance as a new cluster.

Member Function Documentation

◆ EmptyCluster()

template<typename MetricType , typename MatType >
void mlpack::kmeans::MaxVarianceNewCluster::EmptyCluster ( const MatType &  data,
const size_t  emptyCluster,
const arma::mat &  oldCentroids,
arma::mat &  newCentroids,
arma::Col< size_t > &  clusterCounts,
MetricType &  metric,
const size_t  iteration 
)

Take the point furthest from the centroid of the cluster with maximum variance to be a new cluster.

Take action about an empty cluster.

Template Parameters
MatTypeType of data (arma::mat or arma::spmat).
Parameters
dataDataset 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.
clusterCountsNumber of points in each cluster.
metricThe Metric to use.
iterationNumber of iteration.

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