1#ifndef KMEANS_KMEANS_HPP
2#define KMEANS_KMEANS_HPP
48template<
class Matrix_,
typename Cluster_,
typename Float_>
57 auto actual_centers = initialize.
run(data, num_centers, centers);
58 auto output = refine.
run(data, actual_centers, centers, clusters);
59 output.sizes.resize(num_centers);
66template<
typename Cluster_,
typename Float_,
typename Index_>
71 template<
typename Dim_>
72 Results(Dim_ num_dimensions, Index_ num_observations, Cluster_ num_centers) :
112template<
class Matrix_,
typename Cluster_,
typename Float_>
117 Cluster_ num_centers)
120 output.
clusters.resize(data.num_observations());
121 output.
centers.resize(
static_cast<size_t>(num_centers) *
static_cast<size_t>(data.num_dimensions()));
Report detailed clustering statistics.
Class for kmeans++ initialization.
Class for no initialization.
Class for random initialization.
k-means initialization with variance partitioning.
Interface for k-means initialization.
Expectations for matrix inputs.
Implements the Hartigan-Wong algorithm for k-means clustering.
Implements the Lloyd algorithm for k-means clustering.
Implements the mini-batch algorithm for k-means clustering.
Interface for k-means refinement.
Base class for initialization algorithms.
Definition Initialize.hpp:22
virtual Cluster_ run(const Matrix_ &data, Cluster_ num_centers, Float_ *centers) const =0
Interface for all k-means refinement algorithms.
Definition Refine.hpp:23
virtual Details< typename Matrix_::index_type > run(const Matrix_ &data, Cluster_ num_centers, Float_ *centers, Cluster_ *clusters) const =0
Compute within-cluster sum of squares.
Namespace for k-means clustering.
Definition compute_wcss.hpp:12
Details< typename Matrix_::index_type > compute(const Matrix_ &data, const Initialize< Matrix_, Cluster_, Float_ > &initialize, const Refine< Matrix_, Cluster_, Float_ > &refine, Cluster_ num_centers, Float_ *centers, Cluster_ *clusters)
Definition kmeans.hpp:49
Additional statistics from the k-means algorithm.
Definition Details.hpp:20
Full statistics from k-means clustering.
Definition kmeans.hpp:67
std::vector< Float_ > centers
Definition kmeans.hpp:89
std::vector< Cluster_ > clusters
Definition kmeans.hpp:83
Details< Index_ > details
Definition kmeans.hpp:94