kmeans
A C++ library for k-means
Loading...
Searching...
No Matches
InitializeNone.hpp
Go to the documentation of this file.
1#ifndef KMEANS_INITIALIZE_NONE_HPP
2#define KMEANS_INITIALIZE_NONE_HPP
3
4#include "Initialize.hpp"
5#include <algorithm>
6
13namespace kmeans {
14
28template<typename Index_, typename Data_, typename Cluster_, typename Float_, class Matrix_ = Matrix<Index_, Data_> >
29class InitializeNone final : public Initialize<Index_, Data_, Cluster_, Float_, Matrix_> {
30public:
34 Cluster_ run(const Matrix_& matrix, Cluster_ ncenters, Float_*) const {
35 return std::min(matrix.num_observations(), static_cast<Index_>(ncenters));
36 }
40};
41
42}
43
44#endif
Interface for k-means initialization.
No-op "initialization" with existing cluster centers.
Definition InitializeNone.hpp:29
Interface for k-means initialization algorithms.
Definition Initialize.hpp:27
virtual Cluster_ run(const Matrix_ &data, Cluster_ num_centers, Float_ *centers) const =0
Namespace for k-means clustering.
Definition compute_wcss.hpp:12