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

Decision Tree Classifier. More...

#include <DecisionTree.hpp>

Inheritance diagram for faif::ml::DecisionTree< Val >:
Inheritance graph
Collaboration diagram for faif::ml::DecisionTree< Val >:
Collaboration graph

Public Types

typedef Classifier< Val >::AttrValue AttrValue
 
typedef Classifier< Val >::AttrDomain AttrDomain
 
typedef Classifier< Val >::AttrIdd AttrIdd
 
typedef Classifier< Val >::AttrIddSerialize AttrIddSerialize
 
typedef Classifier< Val >::Domains Domains
 
typedef Classifier< Val >::Beliefs Beliefs
 
typedef Classifier< Val >::ExampleTest ExampleTest
 
typedef Classifier< Val >::ExampleTrain ExampleTrain
 
typedef Classifier< Val >::ExamplesTrain ExamplesTrain
 
typedef Val Value
 

Public Member Functions

 DecisionTree (const Domains &attr_domains, const AttrDomain &category_domain)
 
virtual void reset ()
 
virtual void train (const ExamplesTrain &e)
 learn classifier (on the collection of training examples). More...
 
virtual AttrIdd getCategory (const ExampleTest &) const
 
virtual Beliefs getCategories (const ExampleTest &) const
 classify and return all classes with belief that the example is from given class More...
 
virtual void write (std::ostream &os) const
 
const DecisionTreeTrainParamsgetTrainParams () const
 
void setTrainParams (const DecisionTreeTrainParams &p)
 
void prune (const ExamplesTrain &e)
 prune tree - plase not use the example set used for training More...
 
const DomainsgetAttrDomains () const
 accessor More...
 
const AttrDomaingetCategoryDomain () const
 accessor More...
 
AttrIdd getCategoryIdd (const AttrValue &val) const
 accessor (helper) More...
 

Friends

class boost::serialization::access
 serialization using boost::serialization More...
 

Detailed Description

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

Decision Tree Classifier.

Contains the attributes, attribute values and categories, train examples, test examples and classifier methods.

Member Function Documentation

template<typename Val >
void faif::ml::DecisionTree< Val >::reset ( )
virtual
template<typename Val >
void faif::ml::DecisionTree< Val >::train ( const ExamplesTrain e)
virtual

learn classifier (on the collection of training examples).

learn classifier (on the collection of training examples), the decision tree using given train examples

Parameters
etraining examples collection
ALLOWED_NBR_MISC_EXallowed number of badly classified examples for each category

Implements faif::ml::Classifier< Val >.

Referenced by faif::ml::RandomForest< Val >::setTrainParams().

template<typename Val >
DecisionTree< Val >::AttrIdd faif::ml::DecisionTree< Val >::getCategory ( const ExampleTest e) const
virtual

classify

classify - return the major category for best node from decision tree

Implements faif::ml::Classifier< Val >.

Referenced by faif::ml::RandomForest< Val >::setTrainParams().

template<typename Val >
DecisionTree< Val >::Beliefs faif::ml::DecisionTree< Val >::getCategories ( const ExampleTest e) const
virtual

classify and return all classes with belief that the example is from given class

Implements faif::ml::Classifier< Val >.

Referenced by faif::ml::RandomForest< Val >::setTrainParams().

template<typename Val >
void faif::ml::DecisionTree< Val >::write ( std::ostream &  os) const
virtual

the ostream method

ostream method

Reimplemented from faif::ml::Classifier< Val >.

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

template<typename Val>
const DecisionTreeTrainParams& faif::ml::DecisionTree< Val >::getTrainParams ( ) const
inline

accessor - get training parameters

template<typename Val>
void faif::ml::DecisionTree< Val >::setTrainParams ( const DecisionTreeTrainParams p)
inline

mutator - set training parameters

template<typename Val >
void faif::ml::DecisionTree< Val >::prune ( const ExamplesTrain e)

prune tree - plase not use the example set used for training

Return the (smart)pointer to node which replace the old one. If no prunning is performed the input pointer and the output are the same.

bottom-up method, the uneven distribution of categories is not considered

References faif::ml::calcEntropy(), faif::ml::TrainExampleCategoryCounters< Val >::entropy(), faif::ml::TrainExampleCategoryCounters< Val >::get(), faif::ml::TrainExampleCategoryCounters< Val >::getHistogram(), faif::ml::TrainExampleCategoryCounters< Val >::getSum(), and faif::ml::DecisionTree< Val >::write().

template<typename Val>
const Domains& faif::ml::Classifier< Val >::getAttrDomains ( ) const
inlineinherited
template<typename Val>
const AttrDomain& faif::ml::Classifier< Val >::getCategoryDomain ( ) const
inlineinherited

accessor

Referenced by faif::ml::createExample().

template<typename Val>
AttrIdd faif::ml::Classifier< Val >::getCategoryIdd ( const AttrValue val) const
inlineinherited

Friends And Related Function Documentation

template<typename Val>
friend class boost::serialization::access
friend

serialization using boost::serialization


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