38 #ifndef PCL_ML_DT_DECISION_FOREST_EVALUATOR_HPP_ 39 #define PCL_ML_DT_DECISION_FOREST_EVALUATOR_HPP_ 41 #include <pcl/common/common.h> 43 #include <pcl/ml/dt/decision_forest_evaluator.h> 44 #include <pcl/ml/dt/decision_forest.h> 45 #include <pcl/ml/feature_handler.h> 46 #include <pcl/ml/stats_estimator.h> 52 template <
class FeatureType,
class DataSet,
class LabelType,
class ExampleIndex,
class NodeType>
59 template <
class FeatureType,
class DataSet,
class LabelType,
class ExampleIndex,
class NodeType>
65 template <
class FeatureType,
class DataSet,
class LabelType,
class ExampleIndex,
class NodeType>
72 std::vector<ExampleIndex> & examples,
73 std::vector<LabelType> & label_data)
75 const size_t num_of_examples = examples.size ();
76 label_data.resize (num_of_examples, 0);
78 for (
size_t forest_index = 0; forest_index < forest.size (); ++forest_index)
80 tree_evaluator_.evaluateAndAdd (forest[forest_index], feature_handler, stats_estimator, data_set, examples, label_data);
83 const float inv_num_of_trees = 1.0f /
static_cast<float> (forest.size ());
84 for (
size_t label_index = 0; label_index < label_data.size (); ++label_index)
86 label_data[label_index] *= inv_num_of_trees;
91 template<
class FeatureType,
class DataSet,
class LabelType,
class ExampleIndex,
class NodeType>
98 std::vector<NodeType> & leaves)
100 leaves.resize (forest.size ());
101 for (
size_t forest_index = 0; forest_index < forest.size (); ++forest_index)
104 tree_evaluator_.evaluate (forest[forest_index], feature_handler, stats_estimator, data_set, example, leave);
105 leaves[forest_index] = leave;
Class representing a decision forest.
DecisionForestEvaluator()
Constructor.
virtual ~DecisionForestEvaluator()
Destructor.
void evaluate(pcl::DecisionForest< NodeType > &DecisionForestEvaluator, pcl::FeatureHandler< FeatureType, DataSet, ExampleIndex > &feature_handler, pcl::StatsEstimator< LabelType, NodeType, DataSet, ExampleIndex > &stats_estimator, DataSet &data_set, std::vector< ExampleIndex > &examples, std::vector< LabelType > &label_data)
Evaluates the specified examples using the supplied forest.
Utility class interface which is used for creating and evaluating features.