KMeansPlusPlusInitialization Class Reference

This class implements the k-means++ initialization, as described in the following paper: More...

Public Member Functions

 KMeansPlusPlusInitialization ()
 Empty constructor, required by the InitialPartitionPolicy type definition. More...

 

Static Public Member Functions

template
<
typename
MatType
>
static void Cluster (const MatType &data, const size_t clusters, arma::mat &centroids)
 Initialize the centroids matrix by randomly sampling points from the data matrix. More...

 

Detailed Description

This class implements the k-means++ initialization, as described in the following paper:

@inproceedings{arthur2007k,
title={k-means++: The advantages of careful seeding},
author={Arthur, David and Vassilvitskii, Sergei},
booktitle={Proceedings of the Eighteenth Annual ACM-SIAM Symposium on
Discrete Algorithms (SODA '07)},
pages={1027--1035},
year={2007},
organization={Society for Industrial and Applied Mathematics}
}

In accordance with mlpack's InitialPartitionPolicy template type, we only need to implement a constructor and a method to compute the initial centroids.

Definition at line 32 of file kmeans_plus_plus_initialization.hpp.

Constructor & Destructor Documentation

◆ KMeansPlusPlusInitialization()

Empty constructor, required by the InitialPartitionPolicy type definition.

Definition at line 36 of file kmeans_plus_plus_initialization.hpp.

Member Function Documentation

◆ Cluster()

static void Cluster ( const MatType &  data,
const size_t  clusters,
arma::mat &  centroids 
)
inlinestatic

Initialize the centroids matrix by randomly sampling points from the data matrix.

Parameters
dataDataset.
clustersNumber of clusters.
centroidsMatrix to put initial centroids into.

Definition at line 47 of file kmeans_plus_plus_initialization.hpp.

References LMetric< TPower, TTakeRoot >::Evaluate(), mlpack::math::RandInt(), and mlpack::math::Random().


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