kmeans
k-means clustering in C++
|
Interface for k-means initialization algorithms. More...
#include <Initialize.hpp>
Public Member Functions | |
virtual Cluster_ | run (const Matrix_ &data, Cluster_ num_centers, Float_ *centers) const =0 |
Interface for k-means initialization algorithms.
Index_ | Integer type of the observation indices. This should be the same as the index type of Matrix_ . |
Data_ | Numeric type of the input dataset. This should be the same as the data type of Matrix_ . |
Cluster_ | Integer type of the cluster assignments. |
Float_ | Floating-point type of the centroids. |
Matrix_ | Class satisfying the Matrix interface. |
|
pure virtual |
data | A matrix containing data for each observation. | |
num_centers | Number of cluster centers. | |
[out] | centers | Pointer to an array of length equal to the product of num_centers and data.num_dimensions() . This contains a column-major matrix where rows correspond to dimensions and columns correspond to cluster centers. On output, each column will contain the final centroid locations for each cluster. |
centers
is filled with the new cluster centers and the number of filled centers is returned. The latter is usually equal to num_centers
, but may not be if, e.g., num_centers
is greater than the number of observations. If the returned value is less than num_centers
, only the left-most columns in centers
will be filled.