shark::RFTrainer< RealVector > Class Template Reference

#include <shark/Algorithms/Trainers/RFTrainer.h>

+ Inheritance diagram for shark::RFTrainer< RealVector >:

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, LabelTypeWeightedDatasetType
 
- Public Types inherited from shark::IParameterizable< RealVector >
typedef RealVector ParameterVectorType
 

Detailed Description

template<>
class shark::RFTrainer< RealVector >

Definition at line 194 of file RFTrainer.h.

Constructor & Destructor Documentation

◆ RFTrainer()

shark::RFTrainer< RealVector >::RFTrainer ( bool  computeFeatureImportances = false,
bool  computeOOBerror = false 
)
inline

Construct and compute feature importances when training or not.

Definition at line 199 of file RFTrainer.h.

Member Function Documentation

◆ epsilon()

void shark::RFTrainer< RealVector >::epsilon ( double  distance)
inline

The minimum dtsnace of features to be considered different (detault 1.e-10)

Definition at line 237 of file RFTrainer.h.

◆ minImpurity()

void shark::RFTrainer< RealVector >::minImpurity ( double  impurity)
inline

The minimum impurity below which a a node is considere pure (default 1.e-10)

Definition at line 234 of file RFTrainer.h.

◆ name()

std::string shark::RFTrainer< RealVector >::name ( ) const
inlinevirtual

From INameable: return the class name.

Reimplemented from shark::INameable.

Definition at line 212 of file RFTrainer.h.

◆ parameterVector()

RealVector shark::RFTrainer< RealVector >::parameterVector ( ) const
inlinevirtual

Return the parameter vector.

Reimplemented from shark::IParameterizable< RealVector >.

Definition at line 240 of file RFTrainer.h.

◆ setMaxDepth()

void shark::RFTrainer< RealVector >::setMaxDepth ( std::size_t  maxDepth)
inline

Set Maximum depth of the tree (default 10000)

Definition at line 227 of file RFTrainer.h.

◆ setMinSplit()

void shark::RFTrainer< RealVector >::setMinSplit ( std::size_t  numSamples)
inline

Set Minimum number of samples that is split (default 10)

Definition at line 224 of file RFTrainer.h.

◆ setMTry()

void shark::RFTrainer< RealVector >::setMTry ( std::size_t  mtry)
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.

◆ setNodeSize()

void shark::RFTrainer< RealVector >::setNodeSize ( std::size_t  nodeSize)
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.

◆ setNTrees()

void shark::RFTrainer< RealVector >::setNTrees ( std::size_t  numTrees)
inline

Set the number of trees to grow. (default 100)

Definition at line 221 of file RFTrainer.h.

◆ setParameterVector()

void shark::RFTrainer< RealVector >::setParameterVector ( RealVector const &  newParameters)
inlinevirtual

Set the parameter vector.

Reimplemented from shark::IParameterizable< RealVector >.

Definition at line 243 of file RFTrainer.h.

References SHARK_ASSERT.

◆ train()


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