libstp
Robotics library for Botball
Loading...
Searching...
No Matches
Kmeans.hpp
Go to the documentation of this file.
1#ifndef KMEANS_HPP
2#define KMEANS_HPP
3
4#include <vector>
5
6namespace libstp::kmeans {
8 struct KMeansResult {
9 double centroid1;
10 double centroid2;
11 };
12
14 class KMeans {
15 public:
16 KMeans(int maxIterations = 10) : max_iters(maxIterations) {}
17
19 KMeansResult fit(const std::vector<double>& data) const;
20
21 private:
22 int max_iters;
23 };
24}
25
26
27#endif
KMeansResult fit(const std::vector< double > &data) const
Cluster data and return the two final centroids in ascending order.
KMeans(int maxIterations=10)
Definition Kmeans.hpp:16
Result of the current two-centroid 1D clustering pass.
Definition Kmeans.hpp:8