A single projection pursuit decision tree.
More...
#include <Tree.hpp>
A single projection pursuit decision tree.
Each internal node projects data onto a linear combination of features and splits on the projected value. Leaf nodes hold group labels.
DRStrategy::Ptr noop()
Factory function for a no-op DR strategy.
PPStrategy::Ptr pda(float lambda)
Factory function for a PDA projection pursuit strategy.
SRStrategy::Ptr mean_of_means()
Factory function for a mean-of-means split strategy.
pcg32 RNG
Definition Stats.hpp:19
int Response
Scalar type for group labels (integer).
Definition Types.hpp:21
Eigen::Matrix< Response, Eigen::Dynamic, 1 > ResponseVector
Dynamic-size column vector of group labels.
Definition Types.hpp:29
Training configuration for projection pursuit trees and forests.
Definition TrainingSpec.hpp:40
types::Response predict(types::FeatureVector const &data) const override
Predict a single observation.
Tree(TreeNode::Ptr root, TrainingSpec::Ptr training_spec)
static Tree train(TrainingSpec const &training_spec, types::FeatureMatrix const &x, types::ResponseVector const &y, stats::RNG &rng)
Train a tree from a response vector.
◆ Tree()
◆ accept()
◆ operator!=()
| bool ppforest2::Tree::operator!= |
( |
Tree const & | other | ) |
const |
◆ operator==()
| bool ppforest2::Tree::operator== |
( |
Tree const & | other | ) |
const |
◆ predict() [1/3]
Predict a matrix of observations.
- Parameters
-
| data | Feature matrix (n × p). |
- Returns
- Predicted group labels (n).
Implements ppforest2::Model.
◆ predict() [2/3]
Predict proportions for a matrix of observations.
Returns an (n × G) matrix. For forests, each row contains the fraction of trees that voted for each group. For single trees, each row is a one-hot encoding of the predicted group.
- Parameters
-
| data | Feature matrix (n × p). |
- Returns
- Proportion matrix (n × G), rows sum to 1.0.
Implements ppforest2::Model.
◆ predict() [3/3]
Predict a single observation.
- Parameters
-
- Returns
- Predicted group label.
Implements ppforest2::Model.
◆ train() [1/2]
Train a tree from a group partition.
Recursively splits the data by finding optimal projections at each node until pure leaves are reached.
- Parameters
-
| training_spec | Training specification (strategy + DR). |
| x | Feature matrix (n × p). |
| group_spec | Group partition. |
| rng | Random number generator. |
- Returns
- Trained tree.
◆ train() [2/2]
Train a tree from a response vector.
Constructs a GroupPartition from y and delegates to the GroupPartition overload.
- Parameters
-
| training_spec | Training specification (strategy + DR). |
| x | Feature matrix (n × p). |
| y | Response vector (n). |
| rng | Random number generator. |
- Returns
- Trained tree.
◆ root
The documentation for this struct was generated from the following file: