mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Kmeans.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Eigen/Dense>
4#include <mutable/mutable.hpp>
5#include <vector>
6
7
8namespace m {
9
10using MatrixRXf = Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
11
18MatrixRXf M_EXPORT kmeans_plus_plus(const Eigen::MatrixXf &data, unsigned k);
19
31std::pair<std::vector<unsigned>, MatrixRXf> M_EXPORT kmeans_with_centroids(const Eigen::MatrixXf &data, unsigned k);
32
43inline std::vector<unsigned> M_EXPORT kmeans(const Eigen::MatrixXf &data, unsigned k) {
44 return kmeans_with_centroids(data, k).first;
45}
46
47}
‍mutable namespace
Definition: Backend.hpp:10
std::pair< std::vector< unsigned >, MatrixRXf > M_EXPORT kmeans_with_centroids(const Eigen::MatrixXf &data, unsigned k)
Clusters the given data according to the k-means algorithm.
MatrixRXf M_EXPORT kmeans_plus_plus(const Eigen::MatrixXf &data, unsigned k)
Compute initial cluster centroids using k-means++ algorithm.
Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > MatrixRXf
Definition: Kmeans.hpp:10
std::vector< unsigned > M_EXPORT kmeans(const Eigen::MatrixXf &data, unsigned k)
Clusters the given data according to the k-means algorithm.
Definition: Kmeans.hpp:43