libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Functions
crn::kmedoids Namespace Reference

k medoids More...

Namespaces

 init
 
 update
 

Functions

template<typename Init , typename Update >
std::tuple< std::vector
< size_t >, std::vector
< std::multimap< double,
size_t > >, std::vector
< size_t > > 
Run (Init init, Update update, const std::vector< std::vector< double >> &distmat, size_t maxiter=std::numeric_limits< size_t >::max())
 k medoids More...
 

Detailed Description

k medoids

Function Documentation

template<typename Init , typename Update >
std::tuple<std::vector<size_t>, std::vector<std::multimap<double, size_t> >, std::vector<size_t> > crn::kmedoids::Run ( Init  init,
Update  update,
const std::vector< std::vector< double >> &  distmat,
size_t  maxiter = std::numeric_limits<size_t>::max() 
)

k medoids

Exceptions
ExceptionDimensionthe distance matrix is not square
Parameters
[in]inita functor to initialize the medoids: std::vector<size_t> init(const std::vector<std::vector<double>> &distmat)
[in]updatea functor to update the medoids: void update(std::vector<size_t> &medoids, const std::vector<std::vector<size_t>> &clusters, const std::vector<std::vector<double>> &distmat)
[in]distmatthe distance matrix
[in]maxitermaximal number of iterations
Returns
a tuple containing (0)vector<class number>, (1)vector<multimap<distance, element_id>>, (2)vector<element_id>. (0) is the index of the cluster for each element. (1) is the list of elements, sorted by distance, for each cluster. (2) is the list of medoids.

Definition at line 95 of file CRNkMedoids.h.