38 #ifndef PCL_ML_DT_DECISION_TREE_TRAINER_H_
39 #define PCL_ML_DT_DECISION_TREE_TRAINER_H_
41 #include <pcl/common/common.h>
43 #include <pcl/ml/dt/decision_tree.h>
44 #include <pcl/ml/feature_handler.h>
45 #include <pcl/ml/stats_estimator.h>
46 #include <pcl/ml/dt/decision_tree_data_provider.h>
77 feature_handler_ = &feature_handler;
86 stats_estimator_ = &stats_estimator;
95 max_tree_depth_ = max_tree_depth;
104 num_of_features_ = num_of_features;
113 num_of_thresholds_ = num_of_threshold;
122 data_set_ = data_set;
131 examples_ = examples;
140 label_data_ = label_data;
149 min_examples_for_split_ = n;
167 decision_tree_trainer_data_provider_ = dtdp;
176 random_features_at_split_node_ = b;
195 trainDecisionTreeNode (std::vector<FeatureType> & features,
196 std::vector<ExampleIndex> & examples,
197 std::vector<LabelType> & label_data,
207 createThresholdsUniform (
const size_t num_of_thresholds,
208 std::vector<float> & values,
209 std::vector<float> & thresholds);
214 size_t max_tree_depth_;
216 size_t num_of_features_;
218 size_t num_of_thresholds_;
228 std::vector<LabelType> label_data_;
230 std::vector<ExampleIndex> examples_;
233 size_t min_examples_for_split_;
235 std::vector<float> thresholds_;
237 boost::shared_ptr<pcl::DecisionTreeTrainerDataProvider<FeatureType, DataSet, LabelType, ExampleIndex, NodeType> > decision_tree_trainer_data_provider_;
239 bool random_features_at_split_node_;
244 #include <pcl/ml/impl/dt/decision_tree_trainer.hpp>
void setLabelData(std::vector< LabelType > &label_data)
Sets the label data corresponding to the example data.
void setMinExamplesForSplit(size_t n)
Sets the minimum number of examples to continue growing a tree.
Trainer for decision trees.
Class representing a decision tree.
This file defines compatibility wrappers for low level I/O functions.
void setMaxTreeDepth(const size_t max_tree_depth)
Sets the maximum depth of the learned tree.
void setExamples(std::vector< ExampleIndex > &examples)
Example indices that specify the data used for training.
void setNumOfFeatures(const size_t num_of_features)
Sets the number of features used to find optimal decision features.
void setTrainingDataSet(DataSet &data_set)
Sets the input data set used for training.
void setFeatureHandler(pcl::FeatureHandler< FeatureType, DataSet, ExampleIndex > &feature_handler)
Sets the feature handler used to create and evaluate features.
void setNumOfThresholds(const size_t num_of_threshold)
Sets the number of thresholds tested for finding the optimal decision threshold on the feature respon...
void setDecisionTreeDataProvider(boost::shared_ptr< pcl::DecisionTreeTrainerDataProvider< FeatureType, DataSet, LabelType, ExampleIndex, NodeType > > &dtdp)
Specify the data provider.
void setStatsEstimator(pcl::StatsEstimator< LabelType, NodeType, DataSet, ExampleIndex > &stats_estimator)
Sets the object for estimating the statistics for tree nodes.
void setThresholds(std::vector< float > &thres)
Specify the thresholds to be used when evaluating features.
Utility class interface which is used for creating and evaluating features.
void setRandomFeaturesAtSplitNode(bool b)
Specify if the features are randomly generated at each split node.