17 using Point = std::vector<double>;
20 unsigned const int NUMBER_OF_CLUSTER = 2;
21 std::vector<Point> points = { { 0, 0 },
24 std::vector<std::pair<Point , int>> point_cluster_pair;
25 std::vector<Point> centers(NUMBER_OF_CLUSTER);
30 back_inserter(point_cluster_pair));
32 for (
auto i : point_cluster_pair) {
33 for(
auto && j : i.first) {
34 std::cout << j <<
",";
37 std::cout<<
" " << i.second << std::endl;
auto k_means(Points &&points, Centers &¢ers, OutputIterator result, Visitor visitor=Visitor{})
this is solve k_means_clustering problem and return vector of cluster example:
This file contains set of simple useful functors or functor adapters.
auto get_random_centers(Points &&points, int number_of_centers, OutputIterator out, RNG &&rng=std::default_random_engine{})
int main()
[K Means Clustering Example]