41 #include <pcl/ml/dt/decision_tree.h>
42 #include <pcl/ml/dt/decision_tree_data_provider.h>
43 #include <pcl/ml/feature_handler.h>
44 #include <pcl/ml/stats_estimator.h>
51 template <
class FeatureType,
73 feature_handler_ = &feature_handler;
84 stats_estimator_ = &stats_estimator;
94 max_tree_depth_ = max_tree_depth;
104 num_of_features_ = num_of_features;
115 num_of_thresholds_ = num_of_threshold;
125 data_set_ = data_set;
135 examples_ = examples;
145 label_data_ = label_data;
155 min_examples_for_split_ = n;
179 NodeType>::Ptr& dtdp)
181 decision_tree_trainer_data_provider_ = dtdp;
191 random_features_at_split_node_ = b;
212 trainDecisionTreeNode(std::vector<FeatureType>& features,
213 std::vector<ExampleIndex>& examples,
214 std::vector<LabelType>& label_data,
215 std::size_t max_depth,
226 createThresholdsUniform(
const std::size_t num_of_thresholds,
227 std::vector<float>& values,
228 std::vector<float>& thresholds);
232 std::size_t max_tree_depth_;
234 std::size_t num_of_features_;
236 std::size_t num_of_thresholds_;
246 std::vector<LabelType> label_data_;
248 std::vector<ExampleIndex> examples_;
251 std::size_t min_examples_for_split_;
253 std::vector<float> thresholds_;
261 decision_tree_trainer_data_provider_;
264 bool random_features_at_split_node_;
269 #include <pcl/ml/impl/dt/decision_tree_trainer.hpp>
Class representing a decision tree.
Trainer for decision trees.
void setRandomFeaturesAtSplitNode(bool b)
Specify if the features are randomly generated at each split node.
void setStatsEstimator(pcl::StatsEstimator< LabelType, NodeType, DataSet, ExampleIndex > &stats_estimator)
Sets the object for estimating the statistics for tree nodes.
void setDecisionTreeDataProvider(typename pcl::DecisionTreeTrainerDataProvider< FeatureType, DataSet, LabelType, ExampleIndex, NodeType >::Ptr &dtdp)
Specify the data provider.
void setMaxTreeDepth(const std::size_t max_tree_depth)
Sets the maximum depth of the learned tree.
void setNumOfThresholds(const std::size_t num_of_threshold)
Sets the number of thresholds tested for finding the optimal decision threshold on the feature respon...
void setFeatureHandler(pcl::FeatureHandler< FeatureType, DataSet, ExampleIndex > &feature_handler)
Sets the feature handler used to create and evaluate features.
void setTrainingDataSet(DataSet &data_set)
Sets the input data set used for training.
void setMinExamplesForSplit(std::size_t n)
Sets the minimum number of examples to continue growing a tree.
void setThresholds(std::vector< float > &thres)
Specify the thresholds to be used when evaluating features.
void setLabelData(std::vector< LabelType > &label_data)
Sets the label data corresponding to the example data.
void setExamples(std::vector< ExampleIndex > &examples)
Example indices that specify the data used for training.
void setNumOfFeatures(const std::size_t num_of_features)
Sets the number of features used to find optimal decision features.
Utility class interface which is used for creating and evaluating features.
Define standard C methods and C++ classes that are common to all methods.