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
25template<class Matrix_ = SimpleMatrix<double, int>, typename Cluster_ = int, typename Float_ = double>
26class InitializeNone : public Initialize<Matrix_, Cluster_, Float_> {
27public:
28 Cluster_ run(const Matrix_& matrix, Cluster_ ncenters, Float_*) const {
29 return std::min(matrix.num_observations(), static_cast<typename Matrix_::index_type>(ncenters));
30 }
31};
32
33}
34
35#endif
Interface for k-means initialization.
No-op "initialization" with existing cluster centers.
Definition InitializeNone.hpp:26
Cluster_ run(const Matrix_ &matrix, Cluster_ ncenters, Float_ *) const
Definition InitializeNone.hpp:28
Base class for initialization algorithms.
Definition Initialize.hpp:22
Namespace for k-means clustering.
Definition compute_wcss.hpp:12