OTB  6.7.0
Orfeo Toolbox
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue > Class Template Reference

#include <otbSharkRandomForestsMachineLearningModel.h>

+ Inheritance diagram for otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >:
+ Collaboration diagram for otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >:

Public Types

typedef
Superclass::ConfidenceListSampleType 
ConfidenceListSampleType
 
typedef
Superclass::ConfidenceSampleType 
ConfidenceSampleType
 
typedef
Superclass::ConfidenceValueType 
ConfidenceValueType
 
typedef itk::SmartPointer
< const Self
ConstPointer
 
typedef
Superclass::InputListSampleType 
InputListSampleType
 
typedef Superclass::InputSampleType InputSampleType
 
typedef Superclass::InputValueType InputValueType
 
typedef itk::SmartPointer< SelfPointer
 
typedef
Superclass::ProbaListSampleType 
ProbaListSampleType
 
typedef Superclass::ProbaSampleType ProbaSampleType
 
typedef
SharkRandomForestsMachineLearningModel 
Self
 
typedef MachineLearningModel
< TInputValue, TTargetValue > 
Superclass
 
typedef
Superclass::TargetListSampleType 
TargetListSampleType
 
typedef
Superclass::TargetSampleType 
TargetSampleType
 
typedef Superclass::TargetValueType TargetValueType
 
- Public Types inherited from otb::MachineLearningModel< TInputValue, TTargetValue >
typedef MachineLearningModel Self
 
typedef itk::Object Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer
< const Self
ConstPointer
 
typedef MLMSampleTraits
< TInputValue >::ValueType 
InputValueType
 
typedef MLMSampleTraits
< TInputValue >::SampleType 
InputSampleType
 
typedef
itk::Statistics::ListSample
< InputSampleType
InputListSampleType
 
typedef MLMTargetTraits
< TTargetValue >::ValueType 
TargetValueType
 
typedef MLMTargetTraits
< TTargetValue >::SampleType 
TargetSampleType
 
typedef
itk::Statistics::ListSample
< TargetSampleType
TargetListSampleType
 
typedef MLMTargetTraits
< double >::ValueType 
ConfidenceValueType
 
typedef MLMTargetTraits
< double >::SampleType 
ConfidenceSampleType
 
typedef
itk::Statistics::ListSample
< ConfidenceSampleType
ConfidenceListSampleType
 
typedef
itk::VariableLengthVector
< double > 
ProbaSampleType
 
typedef
itk::Statistics::ListSample
< ProbaSampleType
ProbaListSampleType
 
- 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

virtual bool GetComputeMargin ()
 
virtual unsigned int GetMTry ()
 
virtual unsigned int GetNodeSize ()
 
virtual unsigned int GetNumberOfTrees ()
 
virtual float GetOobRatio ()
 
virtual void Load (const std::string &filename, const std::string &name="") override
 
virtual void Save (const std::string &filename, const std::string &name="") override
 
virtual void SetComputeMargin (bool _arg)
 
virtual void SetMTry (unsigned int _arg)
 
virtual void SetNodeSize (unsigned int _arg)
 
virtual void SetNumberOfTrees (unsigned int _arg)
 
virtual void SetOobRatio (float _arg)
 
virtual void Train () override
 
Classification model file compatibility tests
virtual bool CanReadFile (const std::string &) override
 
virtual bool CanWriteFile (const std::string &) override
 
virtual bool GetNormalizeClassLabels ()
 
virtual void SetNormalizeClassLabels (bool _arg)
 
- Public Member Functions inherited from otb::MachineLearningModel< TInputValue, TTargetValue >
bool HasConfidenceIndex () const
 
bool HasProbaIndex () const
 
 itkGetObjectMacro (ConfidenceListSample, ConfidenceListSampleType)
 
TargetSampleType Predict (const InputSampleType &input, ConfidenceValueType *quality=nullptr, ProbaSampleType *proba=nullptr) const
 
TargetListSampleType::Pointer PredictBatch (const InputListSampleType *input, ConfidenceListSampleType *quality=nullptr, ProbaListSampleType *proba=nullptr) const
 
virtual void SetDimension (unsigned int _arg)
 
virtual unsigned int GetDimension ()
 
virtual void SetInputListSample (InputListSampleType *_arg)
 
 itkGetObjectMacro (InputListSample, InputListSampleType)
 
virtual const InputListSampleTypeGetInputListSample () const
 
 itkGetObjectMacro (TargetListSample, TargetListSampleType)
 
virtual void SetTargetListSample (TargetListSampleType *_arg)
 
virtual bool GetRegressionMode ()
 
void SetRegressionMode (bool flag)
 
- 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
 

Protected Member Functions

TargetSampleType DoPredict (const InputSampleType &input, ConfidenceValueType *quality=nullptr, ProbaSampleType *proba=nullptr) const override
 
void DoPredictBatch (const InputListSampleType *, const unsigned int &startIndex, const unsigned int &size, TargetListSampleType *, ConfidenceListSampleType *=nullptr, ProbaListSampleType *=nullptr) const override
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
 SharkRandomForestsMachineLearningModel ()
 
virtual ~SharkRandomForestsMachineLearningModel ()
 
- Protected Member Functions inherited from otb::MachineLearningModel< TInputValue, TTargetValue >
 MachineLearningModel ()
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
 ~MachineLearningModel () override
 
- 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

ConfidenceValueType ComputeConfidence (shark::RealVector &probas, bool computeMargin) const
 
void operator= (const Self &)=delete
 
 SharkRandomForestsMachineLearningModel (const Self &)=delete
 

Private Attributes

std::vector< unsigned int > m_ClassDictionary
 
bool m_ComputeMargin
 
unsigned int m_MTry
 
unsigned int m_NodeSize
 
bool m_NormalizeClassLabels
 
unsigned int m_NumberOfTrees
 
float m_OobRatio
 
shark::RFClassifier< unsigned int > m_RFModel
 
shark::RFTrainer< unsigned int > m_RFTrainer
 
static Pointer New ()
 
virtual ::itk::LightObject::Pointer CreateAnother (void) const
 
virtual const char * GetNameOfClass () const
 

Additional Inherited Members

- 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 Attributes inherited from otb::MachineLearningModel< TInputValue, TTargetValue >
bool m_ConfidenceIndex
 
ConfidenceListSampleType::Pointer m_ConfidenceListSample
 
unsigned int m_Dimension
 
InputListSampleType::Pointer m_InputListSample
 
bool m_IsDoPredictBatchMultiThreaded
 
bool m_IsRegressionSupported
 
bool m_ProbaIndex
 
bool m_RegressionMode
 
TargetListSampleType::Pointer m_TargetListSample
 
InputListSampleType::Pointer m_ValidationListSample
 
- Protected Attributes inherited from itk::LightObject
AtomicInt< int > m_ReferenceCount
 

Detailed Description

template<class TInputValue, class TTargetValue>
class otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >

Definition at line 70 of file otbSharkRandomForestsMachineLearningModel.h.

Member Typedef Documentation

template<class TInputValue, class TTargetValue>
typedef Superclass::ConfidenceListSampleType otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::ConfidenceListSampleType

Definition at line 88 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
typedef Superclass::ConfidenceSampleType otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::ConfidenceSampleType

Definition at line 87 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
typedef Superclass::ConfidenceValueType otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::ConfidenceValueType

Definition at line 86 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
typedef itk::SmartPointer<const Self> otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::ConstPointer

Definition at line 78 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
typedef Superclass::InputListSampleType otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::InputListSampleType

Definition at line 82 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
typedef Superclass::InputSampleType otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::InputSampleType

Definition at line 81 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
typedef Superclass::InputValueType otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::InputValueType

Definition at line 80 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
typedef itk::SmartPointer<Self> otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::Pointer

Definition at line 77 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
typedef Superclass::ProbaListSampleType otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::ProbaListSampleType

Definition at line 90 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
typedef Superclass::ProbaSampleType otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::ProbaSampleType

Definition at line 89 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
typedef SharkRandomForestsMachineLearningModel otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::Self

Standard class typedefs.

Definition at line 75 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
typedef MachineLearningModel<TInputValue, TTargetValue> otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::Superclass

Definition at line 76 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
typedef Superclass::TargetListSampleType otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::TargetListSampleType

Definition at line 85 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
typedef Superclass::TargetSampleType otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::TargetSampleType

Definition at line 84 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
typedef Superclass::TargetValueType otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::TargetValueType

Definition at line 83 of file otbSharkRandomForestsMachineLearningModel.h.

Constructor & Destructor Documentation

template<class TInputValue , class TOutputValue >
SharkRandomForestsMachineLearningModel::SharkRandomForestsMachineLearningModel ( )
protected

Constructor

Definition at line 49 of file otbSharkRandomForestsMachineLearningModel.hxx.

template<class TInputValue , class TOutputValue >
SharkRandomForestsMachineLearningModel::~SharkRandomForestsMachineLearningModel ( )
protectedvirtual

Destructor

Definition at line 62 of file otbSharkRandomForestsMachineLearningModel.hxx.

template<class TInputValue, class TTargetValue>
otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::SharkRandomForestsMachineLearningModel ( const Self )
privatedelete

Member Function Documentation

template<class TInputValue , class TOutputValue >
bool SharkRandomForestsMachineLearningModel::CanReadFile ( const std::string &  file)
overridevirtual

Is the input model file readable and compatible with the corresponding classifier ?

Implements otb::MachineLearningModel< TInputValue, TTargetValue >.

Definition at line 313 of file otbSharkRandomForestsMachineLearningModel.hxx.

template<class TInputValue , class TOutputValue >
bool SharkRandomForestsMachineLearningModel::CanWriteFile ( const std::string &  )
overridevirtual

Is the input model file writable and compatible with the corresponding classifier ?

Implements otb::MachineLearningModel< TInputValue, TTargetValue >.

Definition at line 330 of file otbSharkRandomForestsMachineLearningModel.hxx.

template<class TInputValue , class TOutputValue >
SharkRandomForestsMachineLearningModel< TInputValue, TOutputValue >::ConfidenceValueType SharkRandomForestsMachineLearningModel::ComputeConfidence ( shark::RealVector &  probas,
bool  computeMargin 
) const
private

Confidence list sample

Definition at line 100 of file otbSharkRandomForestsMachineLearningModel.hxx.

template<class TInputValue, class TTargetValue>
virtual::itk::LightObject::Pointer otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::CreateAnother ( void  ) const
virtual

Run-time type information (and related methods).

Reimplemented from itk::Object.

template<class TInputValue , class TOutputValue >
SharkRandomForestsMachineLearningModel< TInputValue, TOutputValue >::TargetSampleType SharkRandomForestsMachineLearningModel::DoPredict ( const InputSampleType input,
ConfidenceValueType quality = nullptr,
ProbaSampleType proba = nullptr 
) const
overrideprotected

Predict values using the model

Definition at line 125 of file otbSharkRandomForestsMachineLearningModel.hxx.

template<class TInputValue , class TOutputValue >
void SharkRandomForestsMachineLearningModel::DoPredictBatch ( const InputListSampleType input,
const unsigned int &  startIndex,
const unsigned int &  size,
TargetListSampleType targets,
ConfidenceListSampleType quality = nullptr,
ProbaListSampleType proba = nullptr 
) const
overrideprotected
template<class TInputValue, class TTargetValue>
virtual bool otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::GetComputeMargin ( )
virtual

If true, margin confidence value will be computed

template<class TInputValue, class TTargetValue>
virtual unsigned int otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::GetMTry ( )
virtual

From Shark doc: Get the number of random attributes to investigate at each node.

template<class TInputValue, class TTargetValue>
virtual const char* otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::GetNameOfClass ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from otb::MachineLearningModel< TInputValue, TTargetValue >.

template<class TInputValue, class TTargetValue>
virtual unsigned int otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::GetNodeSize ( )
virtual

From Shark doc: Controls when a node is considered pure. If set to 1, a node is pure when it only consists of a single node.

template<class TInputValue, class TTargetValue>
virtual bool otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::GetNormalizeClassLabels ( )
virtual

If true, class labels will be normalised in [0 ... nbClasses]

template<class TInputValue, class TTargetValue>
virtual unsigned int otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::GetNumberOfTrees ( )
virtual

From Shark doc: Get the number of trees to grow.

template<class TInputValue, class TTargetValue>
virtual float otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::GetOobRatio ( )
virtual

From Shark doc: Get the fraction of the original training dataset to use as the out of bag sample. The default value is 0.66.

template<class TInputValue , class TOutputValue >
void SharkRandomForestsMachineLearningModel::Load ( const std::string &  filename,
const std::string &  name = "" 
)
overridevirtual

Load the model from file

Implements otb::MachineLearningModel< TInputValue, TTargetValue >.

Definition at line 270 of file otbSharkRandomForestsMachineLearningModel.hxx.

template<class TInputValue, class TTargetValue>
static Pointer otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::New ( )
static

Run-time type information (and related methods).

template<class TInputValue, class TTargetValue>
void otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::operator= ( const Self )
privatedelete
template<class TInputValue , class TOutputValue >
void SharkRandomForestsMachineLearningModel::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
overrideprotectedvirtual

PrintSelf method

Reimplemented from itk::Object.

Definition at line 338 of file otbSharkRandomForestsMachineLearningModel.hxx.

template<class TInputValue , class TOutputValue >
void SharkRandomForestsMachineLearningModel::Save ( const std::string &  filename,
const std::string &  name = "" 
)
overridevirtual
template<class TInputValue, class TTargetValue>
virtual void otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::SetComputeMargin ( bool  _arg)
virtual

If true, margin confidence value will be computed

template<class TInputValue, class TTargetValue>
virtual void otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::SetMTry ( unsigned int  _arg)
virtual

From Shark doc: Set the number of random attributes to investigate at each node.

template<class TInputValue, class TTargetValue>
virtual void otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::SetNodeSize ( unsigned int  _arg)
virtual

From Shark doc: Controls when a node is considered pure. If set to 1, a node is pure when it only consists of a single node.

template<class TInputValue, class TTargetValue>
virtual void otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::SetNormalizeClassLabels ( bool  _arg)
virtual

If true, class labels will be normalised in [0 ... nbClasses]

template<class TInputValue, class TTargetValue>
virtual void otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::SetNumberOfTrees ( unsigned int  _arg)
virtual

From Shark doc: Set the number of trees to grow.

template<class TInputValue, class TTargetValue>
virtual void otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::SetOobRatio ( float  _arg)
virtual

From Shark doc: Set the fraction of the original training dataset to use as the out of bag sample. The default value is 0.66.

template<class TInputValue , class TOutputValue >
void SharkRandomForestsMachineLearningModel::Train ( )
overridevirtual

Train the machine learning model

Implements otb::MachineLearningModel< TInputValue, TTargetValue >.

Definition at line 70 of file otbSharkRandomForestsMachineLearningModel.hxx.

Member Data Documentation

template<class TInputValue, class TTargetValue>
std::vector<unsigned int> otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::m_ClassDictionary
private

Definition at line 179 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
bool otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::m_ComputeMargin
private

Definition at line 186 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
unsigned int otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::m_MTry
private

Definition at line 183 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
unsigned int otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::m_NodeSize
private

Definition at line 184 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
bool otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::m_NormalizeClassLabels
private

Definition at line 180 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
unsigned int otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::m_NumberOfTrees
private

Definition at line 182 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
float otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::m_OobRatio
private

Definition at line 185 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
shark::RFClassifier<unsigned int> otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::m_RFModel
private

Definition at line 177 of file otbSharkRandomForestsMachineLearningModel.h.

template<class TInputValue, class TTargetValue>
shark::RFTrainer<unsigned int> otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::m_RFTrainer
private

Definition at line 178 of file otbSharkRandomForestsMachineLearningModel.h.


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