Point Cloud Library (PCL)  1.9.1-dev
List of all members | Public Member Functions | Protected Member Functions | Static Protected Member Functions
pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType > Class Template Reference

Trainer for decision trees. More...

#include <pcl/ml/dt/decision_tree_trainer.h>

Public Member Functions

 DecisionTreeTrainer ()
 Constructor. More...
 
virtual ~DecisionTreeTrainer ()
 Destructor. More...
 
void setFeatureHandler (pcl::FeatureHandler< FeatureType, DataSet, ExampleIndex > &feature_handler)
 Sets the feature handler used to create and evaluate features. More...
 
void setStatsEstimator (pcl::StatsEstimator< LabelType, NodeType, DataSet, ExampleIndex > &stats_estimator)
 Sets the object for estimating the statistics for tree nodes. More...
 
void setMaxTreeDepth (const size_t max_tree_depth)
 Sets the maximum depth of the learned tree. More...
 
void setNumOfFeatures (const size_t num_of_features)
 Sets the number of features used to find optimal decision features. More...
 
void setNumOfThresholds (const size_t num_of_threshold)
 Sets the number of thresholds tested for finding the optimal decision threshold on the feature responses. More...
 
void setTrainingDataSet (DataSet &data_set)
 Sets the input data set used for training. More...
 
void setExamples (std::vector< ExampleIndex > &examples)
 Example indices that specify the data used for training. More...
 
void setLabelData (std::vector< LabelType > &label_data)
 Sets the label data corresponding to the example data. More...
 
void setMinExamplesForSplit (size_t n)
 Sets the minimum number of examples to continue growing a tree. More...
 
void setThresholds (std::vector< float > &thres)
 Specify the thresholds to be used when evaluating features. More...
 
void setDecisionTreeDataProvider (boost::shared_ptr< pcl::DecisionTreeTrainerDataProvider< FeatureType, DataSet, LabelType, ExampleIndex, NodeType > > &dtdp)
 Specify the data provider. More...
 
void setRandomFeaturesAtSplitNode (bool b)
 Specify if the features are randomly generated at each split node. More...
 
void train (DecisionTree< NodeType > &tree)
 Trains a decision tree using the set training data and settings. More...
 

Protected Member Functions

void trainDecisionTreeNode (std::vector< FeatureType > &features, std::vector< ExampleIndex > &examples, std::vector< LabelType > &label_data, size_t max_depth, NodeType &node)
 Trains a decision tree node from the specified features, label data, and examples. More...
 

Static Protected Member Functions

static void createThresholdsUniform (const size_t num_of_thresholds, std::vector< float > &values, std::vector< float > &thresholds)
 Creates uniformely distrebuted thresholds over the range of the supplied values. More...
 

Detailed Description

template<class FeatureType, class DataSet, class LabelType, class ExampleIndex, class NodeType>
class pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >

Trainer for decision trees.

Definition at line 59 of file decision_tree_trainer.h.

Constructor & Destructor Documentation

template<class FeatureType , class DataSet , class LabelType , class ExampleIndex , class NodeType >
pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::DecisionTreeTrainer ( )

Constructor.

Definition at line 43 of file decision_tree_trainer.hpp.

template<class FeatureType , class DataSet , class LabelType , class ExampleIndex , class NodeType >
pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::~DecisionTreeTrainer ( )
virtual

Destructor.

Definition at line 60 of file decision_tree_trainer.hpp.

Member Function Documentation

template<class FeatureType , class DataSet , class LabelType , class ExampleIndex , class NodeType >
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::createThresholdsUniform ( const size_t  num_of_thresholds,
std::vector< float > &  values,
std::vector< float > &  thresholds 
)
staticprotected

Creates uniformely distrebuted thresholds over the range of the supplied values.

Parameters
[in]num_of_thresholdsThe number of thresholds to create.
[in]valuesThe values for estimating the expected value range.
[out]thresholdsThe resulting thresholds.

Definition at line 277 of file decision_tree_trainer.hpp.

Referenced by pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::trainDecisionTreeNode().

template<class FeatureType, class DataSet, class LabelType, class ExampleIndex, class NodeType>
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::setDecisionTreeDataProvider ( boost::shared_ptr< pcl::DecisionTreeTrainerDataProvider< FeatureType, DataSet, LabelType, ExampleIndex, NodeType > > &  dtdp)
inline

Specify the data provider.

Parameters
[in]dtdpThe data provider that should implement getDatasetAndLabels(...) function

Definition at line 164 of file decision_tree_trainer.h.

template<class FeatureType, class DataSet, class LabelType, class ExampleIndex, class NodeType>
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::setExamples ( std::vector< ExampleIndex > &  examples)
inline

Example indices that specify the data used for training.

Parameters
[in]examplesThe examples.

Definition at line 128 of file decision_tree_trainer.h.

template<class FeatureType, class DataSet, class LabelType, class ExampleIndex, class NodeType>
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::setFeatureHandler ( pcl::FeatureHandler< FeatureType, DataSet, ExampleIndex > &  feature_handler)
inline

Sets the feature handler used to create and evaluate features.

Parameters
[in]feature_handlerThe feature handler.

Definition at line 74 of file decision_tree_trainer.h.

template<class FeatureType, class DataSet, class LabelType, class ExampleIndex, class NodeType>
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::setLabelData ( std::vector< LabelType > &  label_data)
inline

Sets the label data corresponding to the example data.

Parameters
[in]label_dataThe label data.

Definition at line 137 of file decision_tree_trainer.h.

template<class FeatureType, class DataSet, class LabelType, class ExampleIndex, class NodeType>
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::setMaxTreeDepth ( const size_t  max_tree_depth)
inline

Sets the maximum depth of the learned tree.

Parameters
[in]max_tree_depthMaximum depth of the learned tree.

Definition at line 92 of file decision_tree_trainer.h.

template<class FeatureType, class DataSet, class LabelType, class ExampleIndex, class NodeType>
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::setMinExamplesForSplit ( size_t  n)
inline

Sets the minimum number of examples to continue growing a tree.

Parameters
[in]nNumber of examples

Definition at line 146 of file decision_tree_trainer.h.

template<class FeatureType, class DataSet, class LabelType, class ExampleIndex, class NodeType>
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::setNumOfFeatures ( const size_t  num_of_features)
inline

Sets the number of features used to find optimal decision features.

Parameters
[in]num_of_featuresThe number of features.

Definition at line 101 of file decision_tree_trainer.h.

template<class FeatureType, class DataSet, class LabelType, class ExampleIndex, class NodeType>
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::setNumOfThresholds ( const size_t  num_of_threshold)
inline

Sets the number of thresholds tested for finding the optimal decision threshold on the feature responses.

Parameters
[in]num_of_thresholdThe number of thresholds.

Definition at line 110 of file decision_tree_trainer.h.

template<class FeatureType, class DataSet, class LabelType, class ExampleIndex, class NodeType>
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::setRandomFeaturesAtSplitNode ( bool  b)
inline

Specify if the features are randomly generated at each split node.

Parameters
[in]bDo it or not.

Definition at line 173 of file decision_tree_trainer.h.

template<class FeatureType, class DataSet, class LabelType, class ExampleIndex, class NodeType>
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::setStatsEstimator ( pcl::StatsEstimator< LabelType, NodeType, DataSet, ExampleIndex > &  stats_estimator)
inline

Sets the object for estimating the statistics for tree nodes.

Parameters
[in]stats_estimatorThe statistics estimator.

Definition at line 83 of file decision_tree_trainer.h.

template<class FeatureType, class DataSet, class LabelType, class ExampleIndex, class NodeType>
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::setThresholds ( std::vector< float > &  thres)
inline

Specify the thresholds to be used when evaluating features.

Parameters
[in]thresThe threshold values.

Definition at line 155 of file decision_tree_trainer.h.

template<class FeatureType, class DataSet, class LabelType, class ExampleIndex, class NodeType>
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::setTrainingDataSet ( DataSet &  data_set)
inline

Sets the input data set used for training.

Parameters
[in]data_setThe data set used for training.

Definition at line 119 of file decision_tree_trainer.h.

template<class FeatureType , class DataSet , class LabelType , class ExampleIndex , class NodeType >
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::train ( pcl::DecisionTree< NodeType > &  tree)

Trains a decision tree using the set training data and settings.

Parameters
[out]treeDestination for the trained tree.

Definition at line 68 of file decision_tree_trainer.hpp.

References pcl::DecisionTree< NodeType >::getRoot(), pcl::DecisionTree< NodeType >::setRoot(), and pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::trainDecisionTreeNode().

template<class FeatureType , class DataSet , class LabelType , class ExampleIndex , class NodeType >
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::trainDecisionTreeNode ( std::vector< FeatureType > &  features,
std::vector< ExampleIndex > &  examples,
std::vector< LabelType > &  label_data,
size_t  max_depth,
NodeType &  node 
)
protected

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