Point Cloud Library (PCL)
1.8.0
|
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... | |
Trainer for decision trees.
Definition at line 60 of file decision_tree_trainer.h.
pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::DecisionTreeTrainer | ( | ) |
Constructor.
Definition at line 43 of file decision_tree_trainer.hpp.
|
virtual |
Destructor.
Definition at line 60 of file decision_tree_trainer.hpp.
|
staticprotected |
Creates uniformely distrebuted thresholds over the range of the supplied values.
[in] | num_of_thresholds | The number of thresholds to create. |
[in] | values | The values for estimating the expected value range. |
[out] | thresholds | The resulting thresholds. |
Definition at line 277 of file decision_tree_trainer.hpp.
Referenced by pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::trainDecisionTreeNode().
|
inline |
Specify the data provider.
[in] | dtdp | The data provider that should implement getDatasetAndLabels(...) function |
Definition at line 165 of file decision_tree_trainer.h.
|
inline |
Example indices that specify the data used for training.
[in] | examples | The examples. |
Definition at line 129 of file decision_tree_trainer.h.
|
inline |
Sets the feature handler used to create and evaluate features.
[in] | feature_handler | The feature handler. |
Definition at line 75 of file decision_tree_trainer.h.
|
inline |
Sets the label data corresponding to the example data.
[in] | label_data | The label data. |
Definition at line 138 of file decision_tree_trainer.h.
|
inline |
Sets the maximum depth of the learned tree.
[in] | max_tree_depth | Maximum depth of the learned tree. |
Definition at line 93 of file decision_tree_trainer.h.
|
inline |
Sets the minimum number of examples to continue growing a tree.
[in] | n | Number of examples |
Definition at line 147 of file decision_tree_trainer.h.
|
inline |
Sets the number of features used to find optimal decision features.
[in] | num_of_features | The number of features. |
Definition at line 102 of file decision_tree_trainer.h.
|
inline |
Sets the number of thresholds tested for finding the optimal decision threshold on the feature responses.
[in] | num_of_threshold | The number of thresholds. |
Definition at line 111 of file decision_tree_trainer.h.
|
inline |
Specify if the features are randomly generated at each split node.
[in] | b | Do it or not. |
Definition at line 174 of file decision_tree_trainer.h.
|
inline |
Sets the object for estimating the statistics for tree nodes.
[in] | stats_estimator | The statistics estimator. |
Definition at line 84 of file decision_tree_trainer.h.
|
inline |
Specify the thresholds to be used when evaluating features.
[in] | thres | The threshold values. |
Definition at line 156 of file decision_tree_trainer.h.
|
inline |
Sets the input data set used for training.
[in] | data_set | The data set used for training. |
Definition at line 120 of file decision_tree_trainer.h.
void pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::train | ( | pcl::DecisionTree< NodeType > & | tree | ) |
Trains a decision tree using the set training data and settings.
[out] | tree | Destination 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().
|
protected |
Trains a decision tree node from the specified features, label data, and examples.
[in] | features | The feature pool used for training. |
[in] | examples | The examples used for training. |
[in] | label_data | The label data corresponding to the examples. |
[in] | max_depth | The maximum depth of the remaining tree. |
[out] | node | The resulting node. |
Definition at line 101 of file decision_tree_trainer.hpp.
References pcl::StatsEstimator< LabelDataType, NodeType, DataSet, ExampleIndex >::computeAndSetNodeStats(), pcl::StatsEstimator< LabelDataType, NodeType, DataSet, ExampleIndex >::computeBranchIndices(), pcl::StatsEstimator< LabelDataType, NodeType, DataSet, ExampleIndex >::computeInformationGain(), pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::createThresholdsUniform(), and pcl::StatsEstimator< LabelDataType, NodeType, DataSet, ExampleIndex >::getNumOfBranches().
Referenced by pcl::DecisionTreeTrainer< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::train().