OTB  6.7.0
Orfeo Toolbox
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
otb::DecisionTree< AttributeValueType, LabelType > Class Template Reference

#include <otbDecisionTree.h>

+ Inheritance diagram for otb::DecisionTree< AttributeValueType, LabelType >:
+ Collaboration diagram for otb::DecisionTree< AttributeValueType, LabelType >:

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< SelfPointer
 
typedef DecisionTree Self
 
typedef itk::DataObject Superclass
 
typedef std::map< KeyType,
Pointer
TreeMapType
 
- Public Types inherited from itk::DataObject
typedef SmartPointer< const SelfConstPointer
 
typedef std::string DataObjectIdentifierType
 
typedef std::vector< Pointer >
::size_type 
DataObjectPointerArraySizeType
 
typedef SmartPointer< SelfPointer
 
typedef DataObject Self
 
typedef Object Superclass
 
- Public Types inherited from itk::Object
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef Object Self
 
typedef LightObject Superclass
 
- Public Types inherited from itk::LightObject
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef LightObject Self
 

Public Member Functions

void AddBranch (AttributeValueType attr, DecisionTreeTestType testType, Pointer branch)
 
void AddBranch (AttributeValueType attr, Pointer branch)
 
void AddBranch (AttributeValueType attr, DecisionTreeTestType testType, LabelType label)
 
void AddBranch (AttributeValueType attr, LabelType label)
 
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)
 
- Public Member Functions inherited from itk::DataObject
virtual void CopyInformation (const DataObject *)
 
virtual void DataHasBeenGenerated ()
 
void DisconnectPipeline ()
 
bool GetDataReleased () const
 
virtual const ModifiedTimeTypeGetPipelineMTime () const
 
virtual const RealTimeStampGetRealTimeStamp () const
 
virtual const bool & GetReleaseDataFlag () const
 
SmartPointerForwardReference
< ProcessObject
GetSource () const
 
DataObjectPointerArraySizeType GetSourceOutputIndex () const
 
const DataObjectIdentifierTypeGetSourceOutputName () const
 
virtual ModifiedTimeType GetUpdateMTime () const
 
virtual void Graft (const DataObject *)
 
virtual void Initialize ()
 
virtual void PrepareForNewData ()
 
virtual void PropagateRequestedRegion ()
 
void ReleaseData ()
 
virtual void ReleaseDataFlagOff ()
 
virtual void ReleaseDataFlagOn ()
 
virtual bool RequestedRegionIsOutsideOfTheBufferedRegion ()
 
virtual void ResetPipeline ()
 
void SetPipelineMTime (ModifiedTimeType time)
 
virtual void SetRealTimeStamp (RealTimeStamp _arg)
 
void SetReleaseDataFlag (bool flag)
 
virtual void SetRequestedRegion (const DataObject *)
 
virtual void SetRequestedRegionToLargestPossibleRegion ()
 
bool ShouldIReleaseData () const
 
virtual void Update ()
 
virtual void UpdateOutputData ()
 
virtual void UpdateOutputInformation ()
 
virtual bool VerifyRequestedRegion ()
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) const
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
const MetaDataDictionaryGetMetaDataDictionary () const
 
MetaDataDictionaryGetMetaDataDictionary ()
 
virtual ModifiedTimeType GetMTime () const
 
virtual const std::string & GetObjectName () const
 
virtual const TimeStampGetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
virtual void Register () const override
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
virtual void SetObjectName (std::string _arg)
 
virtual void SetReferenceCount (int) override
 
virtual void UnRegister () const noexceptoverride
 
- Public Member Functions inherited from itk::LightObject
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
 itkCloneMacro (Self)
 
void Print (std::ostream &os, Indent indent=0) const
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from itk::DataObject
static bool GetGlobalReleaseDataFlag ()
 
static void GlobalReleaseDataFlagOff ()
 
static void GlobalReleaseDataFlagOn ()
 
static void SetGlobalReleaseDataFlag (bool val)
 
- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool flag)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 

Protected Member Functions

 DecisionTree ()
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
 ~DecisionTree () override
 
- Protected Member Functions inherited from itk::DataObject
 DataObject ()
 
virtual void PropagateResetPipeline ()
 
 ~DataObject ()
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
virtual void SetTimeStamp (const TimeStamp &time)
 
virtual ~Object ()
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 

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
 
TreeMapTypem_TreeMap
 

Additional Inherited Members

- Protected Attributes inherited from itk::LightObject
AtomicInt< int > m_ReferenceCount
 

Detailed Description

template<class AttributeValueType, class LabelType>
class otb::DecisionTree< AttributeValueType, LabelType >

Models a decision tree.

A decision tree holds an attribute that is being tested and 2 maps (STL): one for subtrees and anoter 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.

See Also
DecisionTreeClassifier
DecisionTreeEstimator

Definition at line 61 of file otbDecisionTree.h.

Member Typedef Documentation

template<class AttributeValueType , class LabelType >
typedef itk::SmartPointer<const Self> otb::DecisionTree< AttributeValueType, LabelType >::ConstPointer

Definition at line 70 of file otbDecisionTree.h.

template<class AttributeValueType , class LabelType >
typedef std::vector<AttributeValueType> otb::DecisionTree< AttributeValueType, LabelType >::ExampleType

Definition at line 81 of file otbDecisionTree.h.

template<class AttributeValueType , class LabelType >
typedef std::pair< AttributeValueType, DecisionTreeTestType > otb::DecisionTree< AttributeValueType, LabelType >::KeyType

Definition at line 76 of file otbDecisionTree.h.

template<class AttributeValueType , class LabelType >
typedef std::map< KeyType, LabelType > otb::DecisionTree< AttributeValueType, LabelType >::LabelMapType

Definition at line 80 of file otbDecisionTree.h.

template<class AttributeValueType , class LabelType >
typedef itk::SmartPointer<Self> otb::DecisionTree< AttributeValueType, LabelType >::Pointer

Definition at line 69 of file otbDecisionTree.h.

template<class AttributeValueType , class LabelType >
typedef DecisionTree otb::DecisionTree< AttributeValueType, LabelType >::Self

Standard typedefs

Definition at line 67 of file otbDecisionTree.h.

template<class AttributeValueType , class LabelType >
typedef itk::DataObject otb::DecisionTree< AttributeValueType, LabelType >::Superclass

Definition at line 68 of file otbDecisionTree.h.

template<class AttributeValueType , class LabelType >
typedef std::map< KeyType, Pointer > otb::DecisionTree< AttributeValueType, LabelType >::TreeMapType

Definition at line 79 of file otbDecisionTree.h.

Member Enumeration Documentation

template<class AttributeValueType , class LabelType >
enum otb::DecisionTree::DecisionTreeTestType
Enumerator
MIN 
LT 
LE 
EQ 
GE 
GT 
MAX 

Definition at line 65 of file otbDecisionTree.h.

Constructor & Destructor Documentation

template<class AttributeValueType , class LabelType >
otb::DecisionTree< AttributeValueType, LabelType >::DecisionTree ( )
protected

Constructor

Definition at line 35 of file otbDecisionTree.hxx.

template<class AttributeValueType , class LabelType >
otb::DecisionTree< AttributeValueType, LabelType >::~DecisionTree ( )
overrideprotected

Destructor

Definition at line 47 of file otbDecisionTree.hxx.

template<class AttributeValueType , class LabelType >
otb::DecisionTree< AttributeValueType, LabelType >::DecisionTree ( const Self )
privatedelete

Member Function Documentation

template<class AttributeValueType , class LabelType >
void otb::DecisionTree< AttributeValueType, LabelType >::AddBranch ( AttributeValueType  attr,
DecisionTreeTestType  testType,
Pointer  branch 
)

Add a subtree on the tested attribute

Definition at line 55 of file otbDecisionTree.hxx.

template<class AttributeValueType , class LabelType >
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 65 of file otbDecisionTree.hxx.

template<class AttributeValueType , class LabelType >
void otb::DecisionTree< AttributeValueType, LabelType >::AddBranch ( AttributeValueType  attr,
DecisionTreeTestType  testType,
LabelType  label 
)

Add a leaf node on the tested attribute

Definition at line 75 of file otbDecisionTree.hxx.

template<class AttributeValueType , class LabelType >
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 85 of file otbDecisionTree.hxx.

template<class AttributeValueType , class LabelType >
virtual::itk::LightObject::Pointer otb::DecisionTree< AttributeValueType, LabelType >::CreateAnother ( void  ) const
virtual

Reimplemented from itk::Object.

template<class AttributeValueType , class LabelType >
LabelType otb::DecisionTree< AttributeValueType, LabelType >::Decide ( const ExampleType  example)

Definition at line 95 of file otbDecisionTree.hxx.

References otbMsgDevMacro.

template<class AttributeValueType , class LabelType >
virtual unsigned int otb::DecisionTree< AttributeValueType, LabelType >::GetAttribute ( )
virtual
template<class AttributeValueType , class LabelType >
virtual const char* otb::DecisionTree< AttributeValueType, LabelType >::GetNameOfClass ( ) const
virtual

Runtime information macro

Reimplemented from itk::DataObject.

template<class AttributeValueType , class LabelType >
static Pointer otb::DecisionTree< AttributeValueType, LabelType >::New ( )
static

Creation through object factory macro

template<class AttributeValueType , class LabelType >
void otb::DecisionTree< AttributeValueType, LabelType >::operator= ( const Self )
privatedelete
template<class AttributeValueType , class LabelType >
void otb::DecisionTree< AttributeValueType, LabelType >::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
overrideprotectedvirtual

Output information redefinition PrintSelf method

PrintSelf method

Reimplemented from itk::DataObject.

Definition at line 224 of file otbDecisionTree.hxx.

template<class AttributeValueType , class LabelType >
virtual void otb::DecisionTree< AttributeValueType, LabelType >::SetAttribute ( unsigned int  _arg)
virtual

Member Data Documentation

template<class AttributeValueType , class LabelType >
unsigned int otb::DecisionTree< AttributeValueType, LabelType >::m_Attribute
private

The attribute number (in the vector) being tested

Definition at line 125 of file otbDecisionTree.h.

template<class AttributeValueType , class LabelType >
bool otb::DecisionTree< AttributeValueType, LabelType >::m_IsFinal
private

Is the tree a final node?

Definition at line 128 of file otbDecisionTree.h.

template<class AttributeValueType , class LabelType >
LabelType otb::DecisionTree< AttributeValueType, LabelType >::m_Label
private

Definition at line 130 of file otbDecisionTree.h.

template<class AttributeValueType , class LabelType >
LabelMapType otb::DecisionTree< AttributeValueType, LabelType >::m_LabelMap
private

Map holding the labels if final node

Definition at line 122 of file otbDecisionTree.h.

template<class AttributeValueType , class LabelType >
TreeMapType* otb::DecisionTree< AttributeValueType, LabelType >::m_TreeMap
private

Map holding the subtrees

Definition at line 119 of file otbDecisionTree.h.


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