OTB  9.0.0
Orfeo Toolbox
Public Types | 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 SelfConstPointer
 
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 SelfConstPointer
 
typedef MLMSampleTraits< TInputValue >::ValueType InputValueType
 
typedef MLMSampleTraits< TInputValue >::SampleType InputSampleType
 
typedef itk::Statistics::ListSample< InputSampleTypeInputListSampleType
 
typedef MLMTargetTraits< TTargetValue >::ValueType TargetValueType
 
typedef MLMTargetTraits< TTargetValue >::SampleType TargetSampleType
 
typedef itk::Statistics::ListSample< TargetSampleTypeTargetListSampleType
 
typedef MLMTargetTraits< double >::ValueType ConfidenceValueType
 
typedef MLMTargetTraits< double >::SampleType ConfidenceSampleType
 
typedef itk::Statistics::ListSample< ConfidenceSampleTypeConfidenceListSampleType
 
typedef itk::VariableLengthVector< double > ProbaSampleType
 
typedef itk::Statistics::ListSample< ProbaSampleTypeProbaListSampleType
 
static Pointer New ()
 
virtual ::itk::LightObject::Pointer CreateAnother (void) const
 
virtual const char * GetNameOfClass () const
 
virtual void Train () override
 
virtual void Save (const std::string &filename, const std::string &name="") override
 
virtual void Load (const std::string &filename, const std::string &name="") override
 

Classification model file compatibility tests

shark::RFClassifier< unsigned int > m_RFModel
 
shark::RFTrainer< unsigned int > m_RFTrainer
 
std::vector< unsigned int > m_ClassDictionary
 
bool m_NormalizeClassLabels
 
unsigned int m_NumberOfTrees
 
unsigned int m_MTry
 
unsigned int m_NodeSize
 
float m_OobRatio
 
bool m_ComputeMargin
 
virtual bool CanReadFile (const std::string &) override
 
virtual bool CanWriteFile (const std::string &) override
 
virtual unsigned int GetNumberOfTrees ()
 
virtual void SetNumberOfTrees (unsigned int _arg)
 
virtual unsigned int GetMTry ()
 
virtual void SetMTry (unsigned int _arg)
 
virtual unsigned int GetNodeSize ()
 
virtual void SetNodeSize (unsigned int _arg)
 
virtual float GetOobRatio ()
 
virtual void SetOobRatio (float _arg)
 
virtual bool GetComputeMargin ()
 
virtual void SetComputeMargin (bool _arg)
 
virtual bool GetNormalizeClassLabels ()
 
virtual void SetNormalizeClassLabels (bool _arg)
 
 SharkRandomForestsMachineLearningModel ()
 
 ~SharkRandomForestsMachineLearningModel () override=default
 
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 (const Self &)=delete
 
void operator= (const Self &)=delete
 
ConfidenceValueType ComputeConfidence (shark::RealVector &probas, bool computeMargin) const
 

Additional Inherited Members

- Public Member Functions inherited from otb::MachineLearningModel< TInputValue, TTargetValue >
virtual const char * GetNameOfClass () const
 
TargetSampleType Predict (const InputSampleType &input, ConfidenceValueType *quality=nullptr, ProbaSampleType *proba=nullptr) const
 
virtual void SetDimension (unsigned int _arg)
 
virtual unsigned int GetDimension ()
 
TargetListSampleType::Pointer PredictBatch (const InputListSampleType *input, ConfidenceListSampleType *quality=nullptr, ProbaListSampleType *proba=nullptr) const
 
bool HasConfidenceIndex () const
 
bool HasProbaIndex () const
 
virtual void SetInputListSample (InputListSampleType *_arg)
 
 itkGetObjectMacro (InputListSample, InputListSampleType)
 
virtual const InputListSampleTypeGetInputListSample () const
 
 itkGetObjectMacro (TargetListSample, TargetListSampleType)
 
 itkGetObjectMacro (ConfidenceListSample, ConfidenceListSampleType)
 
virtual void SetTargetListSample (TargetListSampleType *_arg)
 
virtual bool GetRegressionMode ()
 
void SetRegressionMode (bool flag)
 
- Protected Member Functions inherited from otb::MachineLearningModel< TInputValue, TTargetValue >
 MachineLearningModel ()
 
 ~MachineLearningModel () override=default
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
- Protected Attributes inherited from otb::MachineLearningModel< TInputValue, TTargetValue >
InputListSampleType::Pointer m_InputListSample
 
InputListSampleType::Pointer m_ValidationListSample
 
TargetListSampleType::Pointer m_TargetListSample
 
ConfidenceListSampleType::Pointer m_ConfidenceListSample
 
bool m_RegressionMode
 
bool m_IsRegressionSupported
 
bool m_ConfidenceIndex
 
bool m_ProbaIndex
 
bool m_IsDoPredictBatchMultiThreaded
 
unsigned int m_Dimension
 

Detailed Description

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

Definition at line 77 of file otbSharkRandomForestsMachineLearningModel.h.

Member Typedef Documentation

◆ ConfidenceListSampleType

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

Definition at line 94 of file otbSharkRandomForestsMachineLearningModel.h.

◆ ConfidenceSampleType

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

Definition at line 93 of file otbSharkRandomForestsMachineLearningModel.h.

◆ ConfidenceValueType

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

Definition at line 92 of file otbSharkRandomForestsMachineLearningModel.h.

◆ ConstPointer

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

Definition at line 84 of file otbSharkRandomForestsMachineLearningModel.h.

◆ InputListSampleType

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

Definition at line 88 of file otbSharkRandomForestsMachineLearningModel.h.

◆ InputSampleType

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

Definition at line 87 of file otbSharkRandomForestsMachineLearningModel.h.

◆ InputValueType

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

Definition at line 86 of file otbSharkRandomForestsMachineLearningModel.h.

◆ Pointer

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

Definition at line 83 of file otbSharkRandomForestsMachineLearningModel.h.

◆ ProbaListSampleType

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

Definition at line 96 of file otbSharkRandomForestsMachineLearningModel.h.

◆ ProbaSampleType

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

Definition at line 95 of file otbSharkRandomForestsMachineLearningModel.h.

◆ Self

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

Standard class typedefs.

Definition at line 81 of file otbSharkRandomForestsMachineLearningModel.h.

◆ Superclass

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

Definition at line 82 of file otbSharkRandomForestsMachineLearningModel.h.

◆ TargetListSampleType

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

Definition at line 91 of file otbSharkRandomForestsMachineLearningModel.h.

◆ TargetSampleType

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

Definition at line 90 of file otbSharkRandomForestsMachineLearningModel.h.

◆ TargetValueType

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

Definition at line 89 of file otbSharkRandomForestsMachineLearningModel.h.

Constructor & Destructor Documentation

◆ SharkRandomForestsMachineLearningModel() [1/2]

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

Constructor

Definition at line 47 of file otbSharkRandomForestsMachineLearningModel.hxx.

◆ ~SharkRandomForestsMachineLearningModel()

template<class TInputValue , class TTargetValue >
otb::SharkRandomForestsMachineLearningModel< TInputValue, TTargetValue >::~SharkRandomForestsMachineLearningModel ( )
overrideprotecteddefault

Destructor

◆ SharkRandomForestsMachineLearningModel() [2/2]

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

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

Member Function Documentation

◆ CanReadFile()

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 290 of file otbSharkRandomForestsMachineLearningModel.hxx.

◆ CanWriteFile()

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 305 of file otbSharkRandomForestsMachineLearningModel.hxx.

◆ ComputeConfidence()

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

Confidence list sample

Definition at line 86 of file otbSharkRandomForestsMachineLearningModel.hxx.

◆ CreateAnother()

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

Run-time type information (and related methods).

◆ DoPredict()

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 107 of file otbSharkRandomForestsMachineLearningModel.hxx.

◆ DoPredictBatch()

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

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

Definition at line 147 of file otbSharkRandomForestsMachineLearningModel.hxx.

◆ GetComputeMargin()

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

If true, margin confidence value will be computed

◆ GetMTry()

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.

◆ GetNameOfClass()

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

Run-time type information (and related methods).

◆ GetNodeSize()

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.

◆ GetNormalizeClassLabels()

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

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

◆ GetNumberOfTrees()

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

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

◆ GetOobRatio()

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.

◆ Load()

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 249 of file otbSharkRandomForestsMachineLearningModel.hxx.

◆ New()

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

Run-time type information (and related methods).

◆ operator=()

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

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

◆ PrintSelf()

template<class TInputValue , class TOutputValue >
void SharkRandomForestsMachineLearningModel::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
overrideprotected

PrintSelf method

Definition at line 311 of file otbSharkRandomForestsMachineLearningModel.hxx.

◆ Save()

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

◆ SetComputeMargin()

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

If true, margin confidence value will be computed

◆ SetMTry()

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.

◆ SetNodeSize()

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.

◆ SetNormalizeClassLabels()

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

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

◆ SetNumberOfTrees()

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.

◆ SetOobRatio()

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.

◆ Train()

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

Train the machine learning model

Implements otb::MachineLearningModel< TInputValue, TTargetValue >.

Definition at line 59 of file otbSharkRandomForestsMachineLearningModel.hxx.

Member Data Documentation

◆ m_ClassDictionary

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

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

Definition at line 186 of file otbSharkRandomForestsMachineLearningModel.h.

◆ m_ComputeMargin

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

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

Definition at line 193 of file otbSharkRandomForestsMachineLearningModel.h.

◆ m_MTry

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

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

Definition at line 190 of file otbSharkRandomForestsMachineLearningModel.h.

◆ m_NodeSize

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

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

Definition at line 191 of file otbSharkRandomForestsMachineLearningModel.h.

◆ m_NormalizeClassLabels

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

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

Definition at line 187 of file otbSharkRandomForestsMachineLearningModel.h.

◆ m_NumberOfTrees

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

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

Definition at line 189 of file otbSharkRandomForestsMachineLearningModel.h.

◆ m_OobRatio

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

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

Definition at line 192 of file otbSharkRandomForestsMachineLearningModel.h.

◆ m_RFModel

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

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

Definition at line 184 of file otbSharkRandomForestsMachineLearningModel.h.

◆ m_RFTrainer

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

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

Definition at line 185 of file otbSharkRandomForestsMachineLearningModel.h.


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