41#include <pcl/ml/branch_estimator.h>
42#include <pcl/ml/stats_estimator.h>
50template <
class FeatureType,
class LabelType>
68 stream.write(
reinterpret_cast<const char*
>(&threshold),
sizeof(threshold));
70 stream.write(
reinterpret_cast<const char*
>(&value),
sizeof(value));
71 stream.write(
reinterpret_cast<const char*
>(&variance),
sizeof(variance));
88 feature.deserialize(
stream);
90 stream.read(
reinterpret_cast<char*
>(&threshold),
sizeof(threshold));
92 stream.read(
reinterpret_cast<char*
>(&value),
sizeof(value));
93 stream.read(
reinterpret_cast<char*
>(&variance),
sizeof(variance));
125template <
class LabelDataType,
class NodeType,
class DataSet,
class ExampleIndex>
142 return branch_estimator_->getNumOfBranches();
166 std::vector<ExampleIndex>&
examples,
169 std::vector<unsigned char>& flags,
170 const float threshold)
const
234 std::vector<unsigned char>& flags,
235 const float threshold,
259 const unsigned char flag,
260 const float threshold,
277 std::vector<ExampleIndex>&
examples,
279 NodeType& node)
const
299 node.variance = variance;
310 stream <<
"ERROR: RegressionVarianceStatsEstimator does not implement "
311 "generateCodeForBranchIndex(...)";
322 stream <<
"ERROR: RegressionVarianceStatsEstimator does not implement "
323 "generateCodeForBranchIndex(...)";
Interface for branch estimators.
Iterator class for point clouds with or without given indices.
std::size_t size() const
Size of the range the iterator is going through.
Node for a regression trees which optimizes variance.
RegressionVarianceNode()
Constructor.
void serialize(std::ostream &stream) const
Serializes the node to the specified stream.
LabelType variance
The variance of the labels that ended up at this node during training.
void deserialize(std::istream &stream)
Deserializes a node from the specified stream.
float threshold
The threshold applied on the feature response.
FeatureType feature
The feature associated with the node.
LabelType value
The label value of this node.
std::vector< RegressionVarianceNode > sub_nodes
The child nodes.
virtual ~RegressionVarianceNode()
Destructor.
Statistics estimator for regression trees which optimizes variance.
void generateCodeForOutput(NodeType &node, std::ostream &stream) const
Generates code for label output.
void computeAndSetNodeStats(DataSet &data_set, std::vector< ExampleIndex > &examples, std::vector< LabelDataType > &label_data, NodeType &node) const
Computes and sets the statistics for a node.
void computeBranchIndex(const float result, const unsigned char flag, const float threshold, unsigned char &branch_index) const
Computes the branch index for the specified result.
LabelDataType getLabelOfNode(NodeType &node) const
Returns the label of the specified node.
void computeBranchIndices(std::vector< float > &results, std::vector< unsigned char > &flags, const float threshold, std::vector< unsigned char > &branch_indices) const
Computes the branch indices for all supplied results.
virtual ~RegressionVarianceStatsEstimator()
Destructor.
RegressionVarianceStatsEstimator(BranchEstimator *branch_estimator)
Constructor.
float computeInformationGain(DataSet &data_set, std::vector< ExampleIndex > &examples, std::vector< LabelDataType > &label_data, std::vector< float > &results, std::vector< unsigned char > &flags, const float threshold) const
Computes the information gain obtained by the specified threshold.
std::size_t getNumOfBranches() const
Returns the number of branches the corresponding tree has.
void generateCodeForBranchIndexComputation(NodeType &node, std::ostream &stream) const
Generates code for branch index computation.
Class interface for gathering statistics for decision tree learning.
Define standard C methods and C++ classes that are common to all methods.