kmeans
k-means clustering in C++
Loading...
Searching...
No Matches
kmeans::Refine< Index_, Data_, Cluster_, Float_, Matrix_ > Class Template Referenceabstract

Interface for k-means refinement algorithms. More...

#include <Refine.hpp>

Inheritance diagram for kmeans::Refine< Index_, Data_, Cluster_, Float_, Matrix_ >:

Public Member Functions

virtual Details< Index_ > run (const Matrix_ &data, Cluster_ num_centers, Float_ *centers, Cluster_ *clusters) const =0
 

Detailed Description

template<typename Index_, typename Data_, typename Cluster_, typename Float_, typename Matrix_ = Matrix<Index_, Data_>>
class kmeans::Refine< Index_, Data_, Cluster_, Float_, Matrix_ >

Interface for k-means refinement algorithms.

Template Parameters
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.

Member Function Documentation

◆ run()

template<typename Index_ , typename Data_ , typename Cluster_ , typename Float_ , typename Matrix_ = Matrix<Index_, Data_>>
virtual Details< Index_ > kmeans::Refine< Index_, Data_, Cluster_, Float_, Matrix_ >::run ( const Matrix_ & data,
Cluster_ num_centers,
Float_ * centers,
Cluster_ * clusters ) const
pure virtual
Parameters
dataA matrix containing data for each observation.
num_centersNumber of cluster centers.
[in,out]centersPointer 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 input, each column should contain the initial centroid location for its cluster. On output, each column will contain the final centroid location for each cluster.
[out]clustersPointer to an array of length equal to the number of observations (from data.num_observations()). On output, this will contain the 0-based cluster assignment for each observation, where each entry is less than num_centers.
Returns
centers and clusters are filled, and an object is returned containing clustering statistics. If num_centers is greater than data.num_observations(), only the first data.num_observations() columns of the centers array will be filled.

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