21 #ifndef otbRandomForestsMachineLearningModel_h
22 #define otbRandomForestsMachineLearningModel_h
26 #include "itkLightObject.h"
27 #include "itkFixedArray.h"
29 #include "itkVariableSizeMatrix.h"
35 template <
class TInputValue,
class TTargetValue>
66 void Train()
override;
69 void Save(
const std::string& filename,
const std::string& name =
"")
override;
72 void Load(
const std::string& filename,
const std::string& name =
"")
override;
78 bool CanReadFile(
const std::string&)
override;
81 bool CanWriteFile(
const std::string&)
override;
85 itkGetMacro(MaxDepth,
int);
86 itkSetMacro(MaxDepth,
int);
88 itkGetMacro(MinSampleCount,
int);
89 itkSetMacro(MinSampleCount,
int);
91 itkGetMacro(RegressionAccuracy,
double);
92 itkSetMacro(RegressionAccuracy,
double);
94 itkGetMacro(ComputeSurrogateSplit,
bool);
95 itkSetMacro(ComputeSurrogateSplit,
bool);
97 itkGetMacro(MaxNumberOfCategories,
int);
98 itkSetMacro(MaxNumberOfCategories,
int);
110 itkGetMacro(CalculateVariableImportance,
bool);
111 itkSetMacro(CalculateVariableImportance,
bool);
113 itkGetMacro(MaxNumberOfVariables,
int);
114 itkSetMacro(MaxNumberOfVariables,
int);
116 itkGetMacro(MaxNumberOfTrees,
int);
117 itkSetMacro(MaxNumberOfTrees,
int);
119 itkGetMacro(ForestAccuracy,
float);
120 itkSetMacro(ForestAccuracy,
float);
122 itkGetMacro(TerminationCriteria,
int);
123 itkSetMacro(TerminationCriteria,
int);
125 itkGetMacro(ComputeMargin,
bool);
126 itkSetMacro(ComputeMargin,
bool);
129 VariableImportanceMatrixType GetVariableImportance();
131 float GetTrainError();
141 TargetSampleType DoPredict(
const InputSampleType& input, ConfidenceValueType* quality =
nullptr, ProbaSampleType* proba =
nullptr)
const override;
144 void PrintSelf(std::ostream& os, itk::Indent indent)
const override;
154 void operator=(
const Self&) =
delete;
235 #ifndef OTB_MANUAL_INSTANTIATION