#include <shark/Algorithms/Trainers/RFTrainer.h>
Public Member Functions | |
RFTrainer (bool computeFeatureImportances=false, bool computeOOBerror=false) | |
Construct and compute feature importances when training or not. More... | |
std::string | name () const |
From INameable: return the class name. More... | |
void | setMTry (std::size_t mtry) |
void | setNTrees (std::size_t numTrees) |
Set the number of trees to grow. (default 100) More... | |
void | setMinSplit (std::size_t numSamples) |
Set Minimum number of samples that is split (default 10) More... | |
void | setMaxDepth (std::size_t maxDepth) |
Set Maximum depth of the tree (default 10000) More... | |
void | setNodeSize (std::size_t nodeSize) |
void | minImpurity (double impurity) |
The minimum impurity below which a a node is considere pure (default 1.e-10) More... | |
void | epsilon (double distance) |
The minimum dtsnace of features to be considered different (detault 1.e-10) More... | |
RealVector | parameterVector () const |
Return the parameter vector. More... | |
void | setParameterVector (RealVector const &newParameters) |
Set the parameter vector. More... | |
void | train (RFClassifier< LabelType > &model, WeightedLabeledData< RealVector, LabelType > const &dataset) |
Train a random forest for classification. More... | |
Public Member Functions inherited from shark::AbstractWeightedTrainer< RFClassifier< RealVector > > | |
virtual void | train (ModelType &model, WeightedDatasetType const &dataset)=0 |
Executes the algorithm and trains a model on the given weighted data. More... | |
virtual void | train (ModelType &model, DatasetType const &dataset) |
Executes the algorithm and trains a model on the given unweighted data. More... | |
Public Member Functions inherited from shark::INameable | |
virtual | ~INameable () |
Public Member Functions inherited from shark::ISerializable | |
virtual | ~ISerializable () |
Virtual d'tor. More... | |
virtual void | read (InArchive &archive) |
Read the component from the supplied archive. More... | |
virtual void | write (OutArchive &archive) const |
Write the component to the supplied archive. More... | |
void | load (InArchive &archive, unsigned int version) |
Versioned loading of components, calls read(...). More... | |
void | save (OutArchive &archive, unsigned int version) const |
Versioned storing of components, calls write(...). More... | |
BOOST_SERIALIZATION_SPLIT_MEMBER () | |
Public Member Functions inherited from shark::IParameterizable< RealVector > | |
virtual | ~IParameterizable () |
virtual std::size_t | numberOfParameters () const |
Return the number of parameters. More... | |
Additional Inherited Members | |
Public Types inherited from shark::AbstractWeightedTrainer< RFClassifier< RealVector > > | |
typedef base_type::ModelType | ModelType |
typedef base_type::InputType | InputType |
typedef base_type::LabelType | LabelType |
typedef base_type::DatasetType | DatasetType |
typedef WeightedLabeledData< InputType, LabelType > | WeightedDatasetType |
Public Types inherited from shark::IParameterizable< RealVector > | |
typedef RealVector | ParameterVectorType |
Definition at line 194 of file RFTrainer.h.
|
inline |
Construct and compute feature importances when training or not.
Definition at line 199 of file RFTrainer.h.
|
inline |
The minimum dtsnace of features to be considered different (detault 1.e-10)
Definition at line 237 of file RFTrainer.h.
|
inline |
The minimum impurity below which a a node is considere pure (default 1.e-10)
Definition at line 234 of file RFTrainer.h.
|
inlinevirtual |
From INameable: return the class name.
Reimplemented from shark::INameable.
Definition at line 212 of file RFTrainer.h.
|
inlinevirtual |
Return the parameter vector.
Reimplemented from shark::IParameterizable< RealVector >.
Definition at line 240 of file RFTrainer.h.
|
inline |
Set Maximum depth of the tree (default 10000)
Definition at line 227 of file RFTrainer.h.
|
inline |
Set Minimum number of samples that is split (default 10)
Definition at line 224 of file RFTrainer.h.
|
inline |
Set the number of random attributes to investigate at each node.
Defualt is 0 which is translated to inputDim(data)/3 during training
Definition at line 218 of file RFTrainer.h.
|
inline |
Controls when a node is considered pure. If set to 1, a node is pure when it only consists of a single node.(default 5)
Definition at line 231 of file RFTrainer.h.
|
inline |
Set the number of trees to grow. (default 100)
Definition at line 221 of file RFTrainer.h.
|
inlinevirtual |
Set the parameter vector.
Reimplemented from shark::IParameterizable< RealVector >.
Definition at line 243 of file RFTrainer.h.
References SHARK_ASSERT.
|
inline |
Train a random forest for classification.
Definition at line 249 of file RFTrainer.h.
References shark::MeanModel< CARTree< LabelType > >::clearModels(), shark::random::discrete(), shark::Data< Type >::elements(), shark::random::globalRng, shark::inputDimension(), shark::WeightedLabeledData< InputT, LabelT >::inputs(), shark::labelDimension(), shark::WeightedLabeledData< InputT, LabelT >::labels(), and shark::MeanModel< CARTree< LabelType > >::setOutputSize().