Initialises centroids and then assigns the responsibility for each point to its closest centroid.
More...
#include <Clustering.hpp>
Initialises centroids and then assigns the responsibility for each point to its closest centroid.
◆ ClosestCentroid()
ml::Clustering::ClosestCentroid::ClosestCentroid |
( |
std::shared_ptr< const CentroidsInitialiser > |
centroids_initialiser | ) |
|
Constructor.
- Parameters
-
centroids_initialiser | Non-null pointer to CentroidsInitialiser implementation used to initialise the centroids. |
- Exceptions
-
std::invalid_argument | If centroids_initialiser is null. |
◆ init()
void ml::Clustering::ClosestCentroid::init |
( |
Eigen::Ref< const Eigen::MatrixXd > |
data, |
|
|
std::default_random_engine & |
prng, |
|
|
unsigned int |
number_components, |
|
|
Eigen::Ref< Eigen::MatrixXd > |
responsibilities |
|
) |
| const |
|
overridevirtual |
Initialises component responsibilities.
- Parameters
-
[in] | data | Data matrix with data points in columns. |
[in,out] | prng | Pseudo-random number generator. |
[in] | number_components | Number of centroids. Must be less or equal to data.cols() . |
[out] | responsibilities | Destination matrix for component responsibilities, with data.cols() rows and number_components columns. |
Implements ml::Clustering::ResponsibilitiesInitialiser.
The documentation for this class was generated from the following file: