libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions | List of all members
crn::BasicClassify Class Reference

Basic classification tools. More...

#include <CRNBasicClassify.h>

Static Public Member Functions

template<typename ConstIterator , typename std::enable_if< IsMetric< typename std::iterator_traits< ConstIterator >::value_type >::value, int >::type = 0>
static ClassifResult NearestNeighbor (const typename std::iterator_traits< ConstIterator >::value_type &obj, ConstIterator begin, ConstIterator end)
 Finds the nearest neighbor in a set of objects. More...
 
template<typename T , typename std::enable_if< IsMetric< T >::value, int >::type = 0>
static ClassifResult kNearestNeighbors (const T &obj, const Map &database, int k)
 Classify a sample using the k nearest neighbors. More...
 
template<typename T , typename std::enable_if< IsMetric< T >::value, int >::type = 0>
static ClassifResult EpsilonNeighbors (const T &obj, const Map &database, double epsilon)
 Classify a sample using the k nearest neighbors. More...
 

Detailed Description

Basic classification tools.

Basic classifications tools

Author
Yann LEYDIER
Date
July 2008
Version
0.2

Definition at line 47 of file CRNBasicClassify.h.

Member Function Documentation

template<typename T , typename std::enable_if< IsMetric< T >::value, int >::type = 0>
static ClassifResult crn::BasicClassify::EpsilonNeighbors ( const T &  obj,
const Map database,
double  epsilon 
)
inlinestatic

Classify a sample using the k nearest neighbors.

Classify a sample using the k nearest neighbors

Exceptions
std::bad_castthe map does not contain objects of the same type as obj
ExceptionRuntimethe sample is not of the same class as the model
Parameters
[in]objthe sample to classify
[in]databasea map with key=label value=SVector of samples
[in]epsilonthe maximal distance
Returns
the label of-, the distance to- and the nearest prototype whose class is most represented in the k nearest neighbors

Definition at line 156 of file CRNBasicClassify.h.

template<typename T , typename std::enable_if< IsMetric< T >::value, int >::type = 0>
static ClassifResult crn::BasicClassify::kNearestNeighbors ( const T &  obj,
const Map database,
int  k 
)
inlinestatic

Classify a sample using the k nearest neighbors.

Classify a sample using the k nearest neighbors

Exceptions
std::bad_castthe map does not contain objects of the same type as obj
ExceptionRuntimethe sample is not of the same class as the model
Parameters
[in]objthe sample to classify
[in]databasea map with key=label value=SVector of samples
[in]kthe number of nearest neighbors to taken into account
Returns
the label of-, the distance to- and the nearest prototype whose class is most represented in the k nearest neighbors

Definition at line 103 of file CRNBasicClassify.h.

template<typename ConstIterator , typename std::enable_if< IsMetric< typename std::iterator_traits< ConstIterator >::value_type >::value, int >::type = 0>
static ClassifResult crn::BasicClassify::NearestNeighbor ( const typename std::iterator_traits< ConstIterator >::value_type &  obj,
ConstIterator  begin,
ConstIterator  end 
)
inlinestatic

Finds the nearest neighbor in a set of objects.

Finds the nearest neighbor in a set of objects

Exceptions
ExceptionProtocolthe sample is not metric
ExceptionRuntimethe sample is not of the same class as the model
Parameters
[in]objthe sample to classify
[in]beginan input iterator to a pointer to the first prototype
[in]endan input iterator after the last prototype
Returns
the index of-, the distance to- and the nearest neighbor

Definition at line 66 of file CRNBasicClassify.h.


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