libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | List of all members
crn::IterativekNN< DataType, DistFunc > Class Template Reference

Iterative kNN. More...

#include <CRNkNN.h>

Public Member Functions

 IterativekNN (size_t neighborhood, const DistFunc &df, size_t fast_min=50, size_t fast_factor=10, size_t fast_max=100)
 
 IterativekNN (size_t neighborhood, DistFunc &&df, size_t fast_min=50, size_t fast_factor=10, size_t fast_max=100)
 
void Add (const DataType &obj)
 Adds a element with full computation of nearest neighbors. More...
 
void Add (DataType &&obj)
 Adds a element with full computation of nearest neighbors. More...
 
void FastAdd (const DataType &obj)
 Adds a element with partial computation of nearest neighbors. More...
 
void FastAdd (DataType &&obj)
 Adds a element with partial computation of nearest neighbors. More...
 
std::vector< double > GetLOF () const
 
std::vector< double > GetLoOP (double lambda) const
 
const DataType & GetElement (size_t el) const
 
size_t GetNElements () const noexcept
 

Detailed Description

template<typename DataType, typename DistFunc>
class crn::IterativekNN< DataType, DistFunc >

Iterative kNN.

An iterative kNN computation helper

Version
0.2
Date
Aug. 2014
Author
Yann LEYDIER

Definition at line 44 of file CRNkNN.h.

Constructor & Destructor Documentation

template<typename DataType , typename DistFunc >
crn::IterativekNN< DataType, DistFunc >::IterativekNN ( size_t  neighborhood,
const DistFunc &  df,
size_t  fast_min = 50,
size_t  fast_factor = 10,
size_t  fast_max = 100 
)
inline
Parameters
[in]neighborhoodthe size of the neighborhood
[in]dfa distance function: double df(const DataType&, const DataType&)
[in]fast_minminimum number of seeds for fast addition of an element
[in]fast_factorsampling factor for fast addition of an element
[in]fast_maxmaximum number of seeds for fast addition of an element
Exceptions
ExceptionDomainneighborhood <= 1

Definition at line 55 of file CRNkNN.h.

template<typename DataType , typename DistFunc >
crn::IterativekNN< DataType, DistFunc >::IterativekNN ( size_t  neighborhood,
DistFunc &&  df,
size_t  fast_min = 50,
size_t  fast_factor = 10,
size_t  fast_max = 100 
)
inline
Parameters
[in]neighborhoodthe size of the neighborhood
[in]dfa distance function: double df(const DataType&, const DataType&)
[in]fast_minminimum number of seeds for fast addition of an element
[in]fast_factorsampling factor for fast addition of an element
[in]fast_maxmaximum number of seeds for fast addition of an element
Exceptions
ExceptionDomainneighborhood <= 1

Definition at line 65 of file CRNkNN.h.

Member Function Documentation

template<typename DataType , typename DistFunc >
void crn::IterativekNN< DataType, DistFunc >::Add ( const DataType &  obj)
inline

Adds a element with full computation of nearest neighbors.

Parameters
[in]objthe element to add

Definition at line 71 of file CRNkNN.h.

template<typename DataType , typename DistFunc >
void crn::IterativekNN< DataType, DistFunc >::Add ( DataType &&  obj)
inline

Adds a element with full computation of nearest neighbors.

Parameters
[in]objthe element to add

Definition at line 80 of file CRNkNN.h.

template<typename DataType , typename DistFunc >
void crn::IterativekNN< DataType, DistFunc >::FastAdd ( const DataType &  obj)
inline

Adds a element with partial computation of nearest neighbors.

Parameters
[in]objthe element to add

Definition at line 89 of file CRNkNN.h.

template<typename DataType , typename DistFunc >
void crn::IterativekNN< DataType, DistFunc >::FastAdd ( DataType &&  obj)
inline

Adds a element with partial computation of nearest neighbors.

Parameters
[in]objthe element to add

Definition at line 101 of file CRNkNN.h.

template<typename DataType , typename DistFunc >
const DataType& crn::IterativekNN< DataType, DistFunc >::GetElement ( size_t  el) const
inline

Definition at line 177 of file CRNkNN.h.

template<typename DataType , typename DistFunc >
std::vector<double> crn::IterativekNN< DataType, DistFunc >::GetLOF ( ) const
inline
Exceptions
ExceptionDimension#samples < k
Returns
the Local Outlier Factor for all elements

Definition at line 113 of file CRNkNN.h.

template<typename DataType , typename DistFunc >
std::vector<double> crn::IterativekNN< DataType, DistFunc >::GetLoOP ( double  lambda) const
inline
Exceptions
ExceptionDimension#samples < k
Parameters
[in]lambdathe precision of the density estimation (lambda=1 -> 68%, 2 -> 95%, 3 -> 99.7%)
Returns
the Local Outlier Probability for all elements

Definition at line 144 of file CRNkNN.h.

template<typename DataType , typename DistFunc >
size_t crn::IterativekNN< DataType, DistFunc >::GetNElements ( ) const
inlinenoexcept

Definition at line 178 of file CRNkNN.h.


The documentation for this class was generated from the following file: