33 using Ptr = std::unique_ptr<Forest>;
44 std::vector<BaggedTree::Ptr>
trees;
stats::RNG RNG
Definition Forest.hpp:40
void add_tree(BaggedTree::Ptr tree)
Add a trained bagged tree to the forest.
types::FeatureMatrix FeatureMatrix
Definition Forest.hpp:36
std::vector< BaggedTree::Ptr > trees
Bootstrap-aggregated trees. Each BaggedTree pairs the polymorphic inner Tree with its sample indices.
Definition Forest.hpp:44
void accept(Model::Visitor &visitor) const override=0
Accept a model visitor (mode-specific dispatch).
types::OutcomeVector OutcomeVector
Definition Forest.hpp:38
types::Outcome Outcome
Definition Forest.hpp:39
void build_trees(types::FeatureMatrix const &x, types::OutcomeVector const &y)
Build training_spec->size bagged trees in parallel and attach them to this forest.
virtual BaggedTree::Ptr train_tree(FeatureMatrix const &x, OutcomeVector const &y, RNG &rng) const =0
Train one bagged tree on a bootstrap resample of x / y.
static Ptr train(TrainingSpec const &spec, FeatureMatrix const &x, OutcomeVector const &y)
Train a random forest.
bool operator==(Forest const &other) const
types::FeatureVector FeatureVector
Definition Forest.hpp:37
Forest(TrainingSpec::Ptr spec)
Definition Forest.hpp:81
std::unique_ptr< Forest > Ptr
Definition Forest.hpp:33
Outcome predict(FeatureVector const &x) const override=0
Per-row prediction (mode-specific: majority vote or mean).
bool operator!=(Forest const &other) const
Visitor interface for model dispatch.
Definition Model.hpp:51
Abstract base class for predictive models (trees and forests).
Definition Model.hpp:29
virtual types::Outcome predict(types::FeatureVector const &x) const =0
Predict a single observation.
TrainingSpec::Ptr training_spec
Training specification used to build this model.
Definition Model.hpp:70
Training configuration for projection pursuit trees and forests.
Definition TrainingSpec.hpp:43
std::shared_ptr< TrainingSpec > Ptr
Definition TrainingSpec.hpp:45
pcg32 RNG
Definition Stats.hpp:24
Eigen::Matrix< Feature, Eigen::Dynamic, Eigen::Dynamic > FeatureMatrix
Dynamic-size matrix of feature values.
Definition Types.hpp:33
Eigen::Matrix< Outcome, Eigen::Dynamic, 1 > OutcomeVector
Dynamic-size column vector of predictions.
Definition Types.hpp:42
Eigen::Matrix< Feature, Eigen::Dynamic, 1 > FeatureVector
Dynamic-size column vector of feature values.
Definition Types.hpp:36
Feature Outcome
Scalar type for predictions (float for both classification and regression).
Definition Types.hpp:30
Binarization strategies for multiclass-to-binary reduction.
Definition Benchmark.hpp:25
std::unique_ptr< Bagged< Tree > > Ptr
Definition Bagged.hpp:33