An instance of this class can be used to greedily select a given number of representatives from a set of data points that are all far apart from each other. More...
#include <GreedyKCenters.h>
Public Types | |
using | DistanceFunction = std::function< double(const _T &, const _T &)> |
The definition of a distance function. More... | |
using | Matrix = boost::numeric::ublas::matrix< double > |
A matrix type for storing distances between points and centers. More... | |
Public Member Functions | |
const DistanceFunction & | getDistanceFunction () const |
Get the distance function used. More... | |
GreedyKCenters ()=default | |
void | kcenters (const std::vector< _T > &data, unsigned int k, std::vector< unsigned int > ¢ers, Matrix &dists) |
Greedy algorithm for selecting k centers. More... | |
void | setDistanceFunction (const DistanceFunction &distFun) |
Set the distance function to use. More... | |
virtual | ~GreedyKCenters ()=default |
Protected Attributes | |
DistanceFunction | distFun_ |
The used distance function. More... | |
std::mt19937 | generator_ { std::random_device{}() } |
An instance of this class can be used to greedily select a given number of representatives from a set of data points that are all far apart from each other.
Definition at line 52 of file GreedyKCenters.h.
using cached_ik_kinematics_plugin::GreedyKCenters< _T >::DistanceFunction = std::function<double(const _T&, const _T&)> |
The definition of a distance function.
Definition at line 56 of file GreedyKCenters.h.
using cached_ik_kinematics_plugin::GreedyKCenters< _T >::Matrix = boost::numeric::ublas::matrix<double> |
A matrix type for storing distances between points and centers.
Definition at line 58 of file GreedyKCenters.h.
|
default |
|
virtualdefault |
|
inline |
Get the distance function used.
Definition at line 71 of file GreedyKCenters.h.
|
inline |
Greedy algorithm for selecting k centers.
data | a vector of data points |
k | the desired number of centers |
centers | a vector of length k containing the indices into data of the k centers |
dists | a matrix such that dists(i,j) is the distance between data[i] and data[center[j]] |
Definition at line 84 of file GreedyKCenters.h.
|
inline |
Set the distance function to use.
Definition at line 65 of file GreedyKCenters.h.
|
protected |
The used distance function.
Definition at line 126 of file GreedyKCenters.h.
|
protected |
Random number generator used to select first center
Definition at line 129 of file GreedyKCenters.h.