faif
Public Types | Public Member Functions | List of all members
faif::ml::TrainExampleCategoryCounters< Val > Class Template Reference

#include <Classifier.hpp>

Collaboration diagram for faif::ml::TrainExampleCategoryCounters< Val >:
Collaboration graph

Public Types

typedef Classifier< Val >::AttrDomain AttrDomain
 
typedef Classifier< Val >::Domains Domains
 
typedef Classifier< Val >::AttrIdd AttrIdd
 
typedef Classifier< Val >::Beliefs Beliefs
 
typedef Classifier< Val >::ExampleTrain ExampleTrain
 
typedef Classifier< Val >::ExamplesTrain ExamplesTrain
 
typedef std::map< AttrIdd, int > Counters
 

Public Member Functions

 TrainExampleCategoryCounters ()
 c-tor, empty counters More...
 
 TrainExampleCategoryCounters (typename ExamplesTrain::const_iterator beg, typename ExamplesTrain::const_iterator end)
 c-tor, counters initialized by train examples collection More...
 
void inc (const ExampleTrain &e)
 
AttrIdd maxCount () const
 
const Counters & get () const
 access to counters More...
 
int getSum () const
 optimization: instead of accumulate all values from counters container keep the integer member More...
 
double entropy () const
 entropy of counters More...
 
Beliefs getHistogram () const
 histogram from counters - Beliefs class where each position is counter divided by counters sum. More...
 

Detailed Description

template<typename Val>
class faif::ml::TrainExampleCategoryCounters< Val >

helping functor for calculate histogram based on categories for collection of train examples. It could be used to find major category.

Constructor & Destructor Documentation

template<typename Val>
faif::ml::TrainExampleCategoryCounters< Val >::TrainExampleCategoryCounters ( )
inline

c-tor, empty counters

template<typename Val>
faif::ml::TrainExampleCategoryCounters< Val >::TrainExampleCategoryCounters ( typename ExamplesTrain::const_iterator  beg,
typename ExamplesTrain::const_iterator  end 
)
inline

c-tor, counters initialized by train examples collection

Member Function Documentation

template<typename Val>
const Counters& faif::ml::TrainExampleCategoryCounters< Val >::get ( ) const
inline

access to counters

Referenced by faif::ml::DecisionTree< Val >::prune().

template<typename Val>
int faif::ml::TrainExampleCategoryCounters< Val >::getSum ( ) const
inline

optimization: instead of accumulate all values from counters container keep the integer member

Referenced by faif::ml::DecisionTree< Val >::prune().

template<typename Val>
double faif::ml::TrainExampleCategoryCounters< Val >::entropy ( ) const
inline
template<typename Val>
Beliefs faif::ml::TrainExampleCategoryCounters< Val >::getHistogram ( ) const
inline

histogram from counters - Beliefs class where each position is counter divided by counters sum.

Histogram is sorted from biggest to smallest probability

Referenced by faif::ml::DecisionTree< Val >::prune().


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