OTB
9.0.0
Orfeo Toolbox
|
#include <otbDecisionTree.h>
Public Types | |
typedef itk::SmartPointer< const Self > | ConstPointer |
enum | DecisionTreeTestType { MIN, LT = MIN, LE, EQ, GE, GT, MAX = GT } |
typedef std::vector< AttributeValueType > | ExampleType |
typedef std::pair< AttributeValueType, DecisionTreeTestType > | KeyType |
typedef std::map< KeyType, LabelType > | LabelMapType |
typedef itk::SmartPointer< Self > | Pointer |
typedef DecisionTree | Self |
typedef itk::DataObject | Superclass |
typedef std::map< KeyType, Pointer > | TreeMapType |
Public Member Functions | |
void | AddBranch (AttributeValueType attr, DecisionTreeTestType testType, LabelType label) |
void | AddBranch (AttributeValueType attr, DecisionTreeTestType testType, Pointer branch) |
void | AddBranch (AttributeValueType attr, LabelType label) |
void | AddBranch (AttributeValueType attr, Pointer branch) |
virtual ::itk::LightObject::Pointer | CreateAnother (void) const |
LabelType | Decide (const ExampleType &example) |
virtual unsigned int | GetAttribute () |
virtual const char * | GetNameOfClass () const |
virtual void | SetAttribute (unsigned int _arg) |
Static Public Member Functions | |
static Pointer | New () |
Protected Member Functions | |
DecisionTree () | |
void | PrintSelf (std::ostream &os, itk::Indent indent) const override |
~DecisionTree () override | |
Private Member Functions | |
DecisionTree (const Self &)=delete | |
void | operator= (const Self &)=delete |
Private Attributes | |
unsigned int | m_Attribute |
bool | m_IsFinal |
LabelType | m_Label |
LabelMapType | m_LabelMap |
TreeMapType * | m_TreeMap |
Models a decision tree.
A decision tree holds an attribute that is being tested and 2 maps (STL): one for subtrees and another for labels (for the case where there are no subtrees). These maps as keys a pair (STL) which holds the value of the attribute being tested as well as the type of test (LT, LE, EQ, GE, GT).
In order to build a tree, one uses the method AddBranch. There are 2 versions of this method: one for adding a subtree, and another for adding labels in the case of leaf nodes. Each of these versions has a syntactic sugar version for the case of EQ test.
This implementation does not use different classes for terminal and non terminal nodes for simplicity and follows the implementation suggested by P. Norvig in the python version of the AIMA code which is available at http://aima-python.googlecode.com/svn/trunk/learning.py
In the case of several terminal nodes being eligible, the first is returned.
Definition at line 61 of file otbDecisionTree.h.
typedef itk::SmartPointer<const Self> otb::DecisionTree< AttributeValueType, LabelType >::ConstPointer |
Definition at line 78 of file otbDecisionTree.h.
typedef std::vector<AttributeValueType> otb::DecisionTree< AttributeValueType, LabelType >::ExampleType |
Definition at line 89 of file otbDecisionTree.h.
typedef std::pair<AttributeValueType, DecisionTreeTestType> otb::DecisionTree< AttributeValueType, LabelType >::KeyType |
Definition at line 84 of file otbDecisionTree.h.
typedef std::map<KeyType, LabelType> otb::DecisionTree< AttributeValueType, LabelType >::LabelMapType |
Definition at line 88 of file otbDecisionTree.h.
typedef itk::SmartPointer<Self> otb::DecisionTree< AttributeValueType, LabelType >::Pointer |
Definition at line 77 of file otbDecisionTree.h.
typedef DecisionTree otb::DecisionTree< AttributeValueType, LabelType >::Self |
Standard typedefs
Definition at line 75 of file otbDecisionTree.h.
typedef itk::DataObject otb::DecisionTree< AttributeValueType, LabelType >::Superclass |
Definition at line 76 of file otbDecisionTree.h.
typedef std::map<KeyType, Pointer> otb::DecisionTree< AttributeValueType, LabelType >::TreeMapType |
Definition at line 87 of file otbDecisionTree.h.
enum otb::DecisionTree::DecisionTreeTestType |
Enumerator | |
---|---|
MIN | |
LT | |
LE | |
EQ | |
GE | |
GT | |
MAX |
Definition at line 64 of file otbDecisionTree.h.
|
protected |
Constructor
Definition at line 34 of file otbDecisionTree.hxx.
|
overrideprotected |
Destructor
Definition at line 45 of file otbDecisionTree.hxx.
|
privatedelete |
void otb::DecisionTree< AttributeValueType, LabelType >::AddBranch | ( | AttributeValueType | attr, |
DecisionTreeTestType | testType, | ||
LabelType | label | ||
) |
Add a leaf node on the tested attribute
Definition at line 67 of file otbDecisionTree.hxx.
void otb::DecisionTree< AttributeValueType, LabelType >::AddBranch | ( | AttributeValueType | attr, |
DecisionTreeTestType | testType, | ||
Pointer | branch | ||
) |
Add a subtree on the tested attribute
Definition at line 51 of file otbDecisionTree.hxx.
void otb::DecisionTree< AttributeValueType, LabelType >::AddBranch | ( | AttributeValueType | attr, |
LabelType | label | ||
) |
Add a leaf node on the tested attribute - syntactic sugar for the EQ case
Definition at line 75 of file otbDecisionTree.hxx.
void otb::DecisionTree< AttributeValueType, LabelType >::AddBranch | ( | AttributeValueType | attr, |
Pointer | branch | ||
) |
Add a subtree on the tested attribute - syntactic sugar for the EQ case
Definition at line 59 of file otbDecisionTree.hxx.
virtual::itk::LightObject::Pointer otb::DecisionTree< AttributeValueType, LabelType >::CreateAnother | ( | void | ) | const |
LabelType otb::DecisionTree< AttributeValueType, LabelType >::Decide | ( | const ExampleType & | example | ) |
Definition at line 83 of file otbDecisionTree.hxx.
References otbMsgDevMacro.
|
virtual |
|
virtual |
Runtime information macro
|
static |
Creation through object factory macro
|
privatedelete |
|
overrideprotected |
Output information redefinition PrintSelf method
PrintSelf method
Definition at line 209 of file otbDecisionTree.hxx.
|
virtual |
|
private |
The attribute number (in the vector) being tested
Definition at line 133 of file otbDecisionTree.h.
|
private |
Is the tree a final node?
Definition at line 136 of file otbDecisionTree.h.
|
private |
Definition at line 138 of file otbDecisionTree.h.
|
private |
Map holding the labels if final node
Definition at line 130 of file otbDecisionTree.h.
|
private |
Map holding the subtrees
Definition at line 127 of file otbDecisionTree.h.