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

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

#include <kmeans_plus_plus_initialization.hpp>

Public Member Functions

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

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.

Member Function Documentation

◆ Cluster()

template<typename MatType >
static void KMeansPlusPlusInitialization::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.

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