libcrn
3.9.5
A document image processing library
|
Namespaces | |
crn::kmedoids | |
k medoids | |
Classes | |
struct | crn::IterativeClustering< T, type > |
A utility class to create clusters iteratively. More... | |
class | crn::kMeans< T, type, type > |
k-means clustering algorithm More... | |
class | crn::IterativekNN< DataType, DistFunc > |
Iterative kNN. More... | |
class | crn::LazyDistanceMatrix< DATA, DISTANCE > |
Lazy computation of a distance matrix. More... | |
class | crn::SpectralClustering |
Spectral clustering. More... | |
Functions | |
template<typename ITER , typename std::enable_if< std::is_copy_assignable< typename std::iterator_traits< ITER >::value_type >::value &&std::is_assignable< typename std::add_lvalue_reference< typename std::decay< typename std::iterator_traits< ITER >::value_type >::type >::type, int >::value &&traits::HasLT< typename std::iterator_traits< ITER >::value_type >::value &&IsVectorOverR< typename std::iterator_traits< ITER >::value_type >::value, int >::type = 0> | |
std::pair< typename std::iterator_traits< ITER > ::value_type, typename std::iterator_traits< ITER > ::value_type > | crn::TwoMeans (ITER beg, ITER en, double stop_crit=0.00001) |
2-means clustering algorithm for scalar data More... | |
template<typename ITER > | |
std::pair< typename std::iterator_traits< ITER > ::value_type, typename std::iterator_traits< ITER > ::value_type > | crn::TwoMeans (ITER beg, ITER en, typename std::iterator_traits< ITER >::value_type p1, typename std::iterator_traits< ITER >::value_type p2, double stop_crit=0.00001) noexcept(std::is_nothrow_constructible< typename std::iterator_traits< ITER >::value_type >::value &&std::is_nothrow_copy_assignable< typename std::iterator_traits< ITER >::value_type >::value) |
2-means clustering algorithm for scalar data More... | |
template<typename DATA , typename DISTANCE > | |
LazyDistanceMatrix< DATA, DISTANCE > | crn::MakeLazyDistanceMatrix (const std::vector< DATA > &d, DISTANCE &&dist) |
Helper to avoid typing long type names. More... | |
std::vector< double > | crn::ComputeLOF (const SquareMatrixDouble &distmat, size_t k) |
Compute the Local Outlier Factor for each element from the distance matrix. More... | |
std::vector< double > | crn::ComputeLOF (const std::vector< std::vector< double >> &distmat, size_t k) |
Compute the Local Outlier Factor for each element from the distance matrix. More... | |
std::vector< double > | crn::ComputeLoOP (const SquareMatrixDouble &distmat, size_t k, double lambda) |
compute the local outlier probability for each element from the distance matrix More... | |
std::vector< double > | crn::ComputeLoOP (const std::vector< std::vector< double >> &distmat, size_t k, double lambda) |
compute the local outlier probability for each element from the distance matrix More... | |
enum | crn::AProClusters { crn::AProClusters::MEDIUM, crn::AProClusters::LOW } |
Strategies to limit the number of classes in affinity propagation. More... | |
std::pair< std::vector< size_t > , std::vector< size_t > > | crn::AffinityPropagation (const SquareMatrixDouble &distance_matrix, AProClusters nclusters, double damping=0.5, size_t stable_iters_stop=10, size_t max_iter=100) |
Computes clusters and their prototypes. More... | |
std::pair< std::vector< size_t > , std::vector< size_t > > | crn::AffinityPropagation (const SquareMatrixDouble &distance_matrix, double preference, double damping=0.5, size_t stable_iters_stop=10, size_t max_iter=100) |
Computes clusters and their prototypes. More... | |
std::pair< std::vector< size_t > , std::vector< size_t > > | crn::AffinityPropagation (const SquareMatrixDouble &distance_matrix, const std::vector< double > &preference, double damping=0.5, size_t stable_iters_stop=10, size_t max_iter=100) |
Computes clusters and their prototypes. More... | |
|
strong |
Strategies to limit the number of classes in affinity propagation.
Enumerator | |
---|---|
MEDIUM | |
LOW |
Definition at line 36 of file CRNAffinityPropagation.h.
std::pair< std::vector< size_t >, std::vector< size_t > > crn::AffinityPropagation | ( | const SquareMatrixDouble & | distance_matrix, |
AProClusters | nclusters, | ||
double | damping = 0.5 , |
||
size_t | stable_iters_stop = 10 , |
||
size_t | max_iter = 100 |
||
) |
Computes clusters and their prototypes.
Computes clusters and their prototypes
[in] | distance_matrix | the distance matrix of the elements to cluster |
[in] | nclusters | the strategy to limit the number of clusters |
[in] | damping | the damping rate. 0 = no damping, default = 0.5. The higher the value the slower the algorithm will converge. Low values may result in oscillations. |
[in] | stable_iters_stop | number of consecutive identical clusterings to stop the algorithm (default = 10). |
[in] | max_iter | maximum number of iterations (default = 100). |
Definition at line 128 of file CRNAffinityPropagation.cpp.
std::pair< std::vector< size_t >, std::vector< size_t > > crn::AffinityPropagation | ( | const SquareMatrixDouble & | distance_matrix, |
double | preference, | ||
double | damping = 0.5 , |
||
size_t | stable_iters_stop = 10 , |
||
size_t | max_iter = 100 |
||
) |
Computes clusters and their prototypes.
Computes clusters and their prototypes
[in] | distance_matrix | the distance matrix of the elements to cluster |
[in] | preference | the "preference" value that drives the number of cluster (e.g: mean, median or max distance). The higher the value, the smaller the number of clusters. |
[in] | damping | the damping rate. 0 = no damping, default = 0.5. The higher the value the slower the algorithm will converge. Low values may result in oscillations. |
[in] | stable_iters_stop | number of consecutive identical clusterings to stop the algorithm (default = 10). |
[in] | max_iter | maximum number of iterations (default = 100). |
Definition at line 160 of file CRNAffinityPropagation.cpp.
std::pair< std::vector< size_t >, std::vector< size_t > > crn::AffinityPropagation | ( | const SquareMatrixDouble & | distance_matrix, |
const std::vector< double > & | preference, | ||
double | damping = 0.5 , |
||
size_t | stable_iters_stop = 10 , |
||
size_t | max_iter = 100 |
||
) |
Computes clusters and their prototypes.
Computes clusters and their prototypes
[in] | distance_matrix | the distance matrix of the elements to cluster |
[in] | preference | the "preference" values that tells which elements are more likely to be cluster prototypes and that drives the number of cluster. The higher the values, the smaller the number of clusters. |
[in] | damping | the damping rate. 0 = no damping, default = 0.5. The higher the value the slower the algorithm will converge. Low values may result in oscillations. |
[in] | stable_iters_stop | number of consecutive identical clusterings to stop the algorithm (default = 10). |
[in] | max_iter | maximum number of iterations (default = 100). |
Definition at line 178 of file CRNAffinityPropagation.cpp.
std::vector< double > crn::ComputeLOF | ( | const SquareMatrixDouble & | distmat, |
size_t | k | ||
) |
Compute the Local Outlier Factor for each element from the distance matrix.
Compute the Local Outlier Factor for each element from the distance matrix
[in] | distamat | a square matrix |
[in] | k | the size of the neighborhood |
ExceptionDomain | k<=1 |
ExceptionDimension | distmat is not square |
ExceptionLogic | k > distmat.size() |
Definition at line 89 of file CRNOutliers.cpp.
std::vector< double > crn::ComputeLOF | ( | const std::vector< std::vector< double >> & | distmat, |
size_t | k | ||
) |
Compute the Local Outlier Factor for each element from the distance matrix.
Compute the Local Outlier Factor for each element from the distance matrix
[in] | distamat | a square matrix |
[in] | k | the size of the neighborhood |
ExceptionDomain | k<=1 |
ExceptionDimension | distmat is not square |
ExceptionLogic | k > distmat.size() |
Definition at line 106 of file CRNOutliers.cpp.
std::vector< double > crn::ComputeLoOP | ( | const SquareMatrixDouble & | distmat, |
size_t | k, | ||
double | lambda | ||
) |
compute the local outlier probability for each element from the distance matrix
Compute the Local Outlier Probability for each element from the distance matrix
[in] | distamat | a square matrix |
[in] | k | the size of the neighborhood |
[in] | lambda | the precision of the density estimation (lambda=1 -> 68%, 2 -> 95%, 3 -> 99.7%) |
ExceptionDomain | k<=1 or lambda<=0 |
ExceptionDimension | distmat is not square |
ExceptionLogic | k > distmat.size() |
Definition at line 182 of file CRNOutliers.cpp.
std::vector< double > crn::ComputeLoOP | ( | const std::vector< std::vector< double >> & | distmat, |
size_t | k, | ||
double | lambda | ||
) |
compute the local outlier probability for each element from the distance matrix
Compute the Local Outlier Probability for each element from the distance matrix
[in] | distamat | a square matrix |
[in] | k | the size of the neighborhood |
[in] | lambda | the precision of the density estimation (lambda=1 -> 68%, 2 -> 95%, 3 -> 99.7%) |
ExceptionDomain | k<=1 or lambda<=0 |
ExceptionDimension | distmat is not square |
ExceptionLogic | k > distmat.size() |
Definition at line 200 of file CRNOutliers.cpp.
|
inline |
Helper to avoid typing long type names.
[in] | d | the population |
[in] | dist | the distance function |
Definition at line 107 of file CRNLazyDistanceMatrix.h.
std::pair<typename std::iterator_traits<ITER>::value_type, typename std::iterator_traits<ITER>::value_type> crn::TwoMeans | ( | ITER | beg, |
ITER | en, | ||
double | stop_crit = 0.00001 |
||
) |
2-means clustering algorithm for scalar data
2-means clustering utility for scalar data.
ExceptionDomain | the range is empty |
[in] | beg | iterator on the first element |
[in] | en | iterator after the last element |
[in] | stop_crit | the maximal difference between two iterations to stop the algorithm |
Definition at line 60 of file CRN2Means.h.
|
noexcept |
2-means clustering algorithm for scalar data
2-means clustering utility for scalar data.
ExceptionDomain | the range is empty |
[in] | beg | iterator on the first element |
[in] | en | iterator after the last element |
[in] | p1 | first prototype |
[in] | p2 | first prototype |
[in] | stop_crit | the maximal difference between two iterations to stop the algorithm |
Definition at line 123 of file CRN2Means.h.