faif
|
Decision Tree Classifier. More...
#include <DecisionTree.hpp>
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 DecisionTreeTrainParams & | getTrainParams () const |
void | setTrainParams (const DecisionTreeTrainParams &p) |
void | prune (const ExamplesTrain &e) |
prune tree - plase not use the example set used for training More... | |
const Domains & | getAttrDomains () const |
accessor More... | |
const AttrDomain & | getCategoryDomain () const |
accessor More... | |
AttrIdd | getCategoryIdd (const AttrValue &val) const |
accessor (helper) More... | |
Friends | |
class | boost::serialization::access |
serialization using boost::serialization More... | |
Decision Tree Classifier.
Contains the attributes, attribute values and categories, train examples, test examples and classifier methods.
|
virtual |
clear the tree
Implements faif::ml::Classifier< Val >.
Referenced by faif::ml::RandomForest< Val >::setTrainParams().
|
virtual |
learn classifier (on the collection of training examples).
learn classifier (on the collection of training examples), the decision tree using given train examples
e | training examples collection |
ALLOWED_NBR_MISC_EX | allowed number of badly classified examples for each category |
Implements faif::ml::Classifier< Val >.
Referenced by faif::ml::RandomForest< Val >::setTrainParams().
|
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().
|
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().
|
virtual |
the ostream method
ostream method
Reimplemented from faif::ml::Classifier< Val >.
Referenced by faif::ml::DecisionTree< Val >::prune().
|
inline |
accessor - get training parameters
|
inline |
mutator - set training parameters
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().
|
inlineinherited |
accessor
Referenced by faif::ml::createExample(), faif::ml::createExampleStrict(), and faif::ml::RandomForest< Val >::getCategories().
|
inlineinherited |
accessor
Referenced by faif::ml::createExample().
|
inlineinherited |
|
friend |
serialization using boost::serialization