ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
RegressionForest.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "models/Forest.hpp"
4
5namespace ppforest2 {
13 class RegressionForest : public Forest {
14 public:
15 using Ptr = std::unique_ptr<RegressionForest>;
16 using Forest::predict;
17
22
23
26
27 static Ptr train(TrainingSpec const& spec, FeatureMatrix const& x, OutcomeVector const& y);
28
29 types::Outcome predict(FeatureVector const& x) const override;
30
31 void accept(Model::Visitor& visitor) const override;
32
33 protected:
34 BaggedTree::Ptr train_tree(FeatureMatrix const& x, OutcomeVector const& y, stats::RNG& rng) const override;
35 };
36}
Outcome predict(FeatureVector const &x) const override=0
Per-row prediction (mode-specific: majority vote or mean).
Visitor interface for model dispatch.
Definition Model.hpp:51
types::Outcome Outcome
Definition RegressionForest.hpp:21
RegressionForest(TrainingSpec::Ptr spec)
BaggedTree::Ptr train_tree(FeatureMatrix const &x, OutcomeVector const &y, stats::RNG &rng) const override
Train one bagged tree on a bootstrap resample of x / y.
std::unique_ptr< RegressionForest > Ptr
Definition RegressionForest.hpp:15
static Ptr train(TrainingSpec const &spec, FeatureMatrix const &x, OutcomeVector const &y)
types::FeatureMatrix FeatureMatrix
Definition RegressionForest.hpp:18
types::Outcome predict(FeatureVector const &x) const override
Per-row prediction (mode-specific: majority vote or mean).
types::OutcomeVector OutcomeVector
Definition RegressionForest.hpp:20
void accept(Model::Visitor &visitor) const override
Accept a model visitor (mode-specific dispatch).
types::FeatureVector FeatureVector
Definition RegressionForest.hpp:19
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