kmeans
A C++ library for k-means
Loading...
Searching...
No Matches
Public Member Functions | List of all members
kmeans::Refine< Matrix_, Cluster_, Float_ > Class Template Referenceabstract

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

#include <Refine.hpp>

Inheritance diagram for kmeans::Refine< Matrix_, Cluster_, Float_ >:
Inheritance graph
[legend]

Public Member Functions

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

Detailed Description

template<typename Matrix_ = SimpleMatrix<double, int>, typename Cluster_ = int, typename Float_ = double>
class kmeans::Refine< Matrix_, Cluster_, Float_ >

Interface for all k-means refinement algorithms.

Template Parameters
Matrix_Matrix type for the input data. This should satisfy the MockMatrix contract.
Cluster_Integer type for the cluster assignments.
Float_Floating-point type for the centroids.

Member Function Documentation

◆ run()

template<typename Matrix_ = SimpleMatrix<double, int>, typename Cluster_ = int, typename Float_ = double>
virtual Details< typename Matrix_::index_type > kmeans::Refine< Matrix_, Cluster_, Float_ >::run ( const Matrix_ data,
Cluster_  num_centers,
Float_ centers,
Cluster_ clusters 
) const
pure virtual
Parameters
dataA matrix-like object (see MockMatrix) containing per-observation data.
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 locations 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 cluster assignment for each observation.
Returns
centers and clusters are filled, and a Details 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.

Implemented in kmeans::RefineHartiganWong< Matrix_, Cluster_, Float_ >, kmeans::RefineLloyd< Matrix_, Cluster_, Float_ >, and kmeans::RefineMiniBatch< Matrix_, Cluster_, Float_ >.


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