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 ¢roids) |
Initialize the centroids matrix by randomly sampling points from the data matrix. More... | |
This class implements the k-means++ initialization, as described in the following paper:
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.
|
inline |
Empty constructor, required by the InitialPartitionPolicy type definition.
Definition at line 36 of file kmeans_plus_plus_initialization.hpp.
|
inlinestatic |
Initialize the centroids matrix by randomly sampling points from the data matrix.
data | Dataset. |
clusters | Number of clusters. |
centroids | Matrix 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().