|
ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
|
Training configuration for projection pursuit trees and forests. More...
#include <TrainingSpec.hpp>
Public Types | |
| using | Ptr = std::shared_ptr<TrainingSpec> |
Public Member Functions | |
| TrainingSpec (pp::PPStrategy::Ptr pp, dr::DRStrategy::Ptr dr, sr::SRStrategy::Ptr sr, int size=0, int seed=0, int threads=0, int max_retries=3) | |
| Construct a training specification. | |
| bool | is_forest () const |
| Whether this specification describes a forest (size > 0). | |
| int | resolve_threads () const |
| Get the number of threads to use for training. | |
| void | to_json (nlohmann::json &j) const |
| Serialize the training spec to JSON. | |
Static Public Member Functions | |
| static Ptr | from_json (nlohmann::json const &j) |
| Deserialize a training spec from JSON. | |
| template<typename... Args> | |
| static Ptr | make (Args &&... args) |
| Create a shared pointer to a TrainingSpec. | |
Public Attributes | |
| dr::DRStrategy::Ptr const | dr_strategy |
| Dimensionality reduction strategy. | |
| int const | max_retries |
| Maximum retry attempts for degenerate trees. | |
| pp::PPStrategy::Ptr const | pp_strategy |
| Projection pursuit optimization strategy. | |
| int const | seed |
| RNG seed. | |
| int const | size |
| Number of trees (0 = single tree). | |
| sr::SRStrategy::Ptr const | sr_strategy |
| Group splitting rule strategy. | |
| int const | threads |
| Number of threads for parallel forest training. | |
Training configuration for projection pursuit trees and forests.
Composes a projection pursuit strategy (PPStrategy), a dimensionality reduction strategy (DRStrategy), and a split strategy (SRStrategy), together with forest-level parameters (size, seed, threads, max retries).
TrainingSpec is a concrete class — new strategies are plugged in via the constructor, not by subclassing:
Strategies are held via shared_ptr and are immutable after construction, so TrainingSpec can be freely copied and shared across trees without deep cloning.
| using ppforest2::TrainingSpec::Ptr = std::shared_ptr<TrainingSpec> |
| ppforest2::TrainingSpec::TrainingSpec | ( | pp::PPStrategy::Ptr | pp, |
| dr::DRStrategy::Ptr | dr, | ||
| sr::SRStrategy::Ptr | sr, | ||
| int | size = 0, | ||
| int | seed = 0, | ||
| int | threads = 0, | ||
| int | max_retries = 3 ) |
Construct a training specification.
| pp | Projection pursuit strategy. |
| dr | Dimensionality reduction strategy. |
| sr | Split rule strategy. |
| size | Number of trees (0 = single tree). |
| seed | RNG seed. |
| threads | Number of threads (0 = hardware concurrency). |
| max_retries | Maximum retry attempts for degenerate trees. |
|
static |
Deserialize a training spec from JSON.
|
inline |
Whether this specification describes a forest (size > 0).
|
inlinestatic |
Create a shared pointer to a TrainingSpec.
Convenience factory that forwards all arguments to the constructor.
|
inline |
Get the number of threads to use for training.
If the number of threads is not specified, the number of hardware concurrency is returned.
| void ppforest2::TrainingSpec::to_json | ( | nlohmann::json & | j | ) | const |
Serialize the training spec to JSON.
| dr::DRStrategy::Ptr const ppforest2::TrainingSpec::dr_strategy |
Dimensionality reduction strategy.
| int const ppforest2::TrainingSpec::max_retries |
Maximum retry attempts for degenerate trees.
| pp::PPStrategy::Ptr const ppforest2::TrainingSpec::pp_strategy |
Projection pursuit optimization strategy.
| int const ppforest2::TrainingSpec::seed |
RNG seed.
| int const ppforest2::TrainingSpec::size |
Number of trees (0 = single tree).
| sr::SRStrategy::Ptr const ppforest2::TrainingSpec::sr_strategy |
Group splitting rule strategy.
| int const ppforest2::TrainingSpec::threads |
Number of threads for parallel forest training.