ferrolearn-tree 0.2.2

Decision tree and ensemble models for the ferrolearn ML framework
Documentation
//! # ferrolearn-tree
//!
//! Decision tree and ensemble tree models for the ferrolearn machine learning framework.
//!
//! This crate provides implementations of:
//!
//! - **[`DecisionTreeClassifier`]** / **[`DecisionTreeRegressor`]** — CART decision trees
//!   with configurable splitting criteria, depth limits, and minimum sample constraints.
//! - **[`RandomForestClassifier`]** / **[`RandomForestRegressor`]** — Bootstrap-aggregated
//!   ensembles of decision trees with random feature subsets, built in parallel via `rayon`.
//! - **[`GradientBoostingClassifier`]** / **[`GradientBoostingRegressor`]** — Gradient boosting
//!   ensembles that sequentially fit trees to the negative gradient of a loss function.
//! - **[`HistGradientBoostingClassifier`]** / **[`HistGradientBoostingRegressor`]** —
//!   Histogram-based gradient boosting with O(n_bins) split finding, subtraction trick,
//!   native NaN support, and optional best-first (leaf-wise) growth.
//! - **[`AdaBoostClassifier`]** — Adaptive Boosting using decision tree stumps with
//!   SAMME and SAMME.R algorithms.
//! - **[`ExtraTreeClassifier`]** / **[`ExtraTreeRegressor`]** — Extremely randomized
//!   trees where split thresholds are chosen randomly rather than via exhaustive search.
//! - **[`ExtraTreesClassifier`]** / **[`ExtraTreesRegressor`]** — Ensembles of
//!   extremely randomized trees with Rayon parallel fitting. No bootstrap by default.
//! - **[`IsolationForest`]** — Anomaly detection via random isolation trees.
//! - **[`VotingClassifier`]** / **[`VotingRegressor`]** — Ensembles of decision trees
//!   with varying hyperparameters, aggregated by majority vote or averaging.
//! - **[`RandomTreesEmbedding`]** — Unsupervised feature transformation via one-hot
//!   encoded leaf indices across an ensemble of randomly built trees.
//!
//! # Design
//!
//! Each model follows the compile-time safety pattern:
//!
//! - The unfitted struct (e.g., `DecisionTreeClassifier<F>`) holds hyperparameters
//!   and implements [`Fit`](ferrolearn_core::Fit).
//! - Calling `fit()` produces a new fitted type (e.g., `FittedDecisionTreeClassifier<F>`)
//!   that implements [`Predict`](ferrolearn_core::Predict).
//! - Calling `predict()` on an unfitted model is a compile-time error.
//!
//! # Pipeline Integration
//!
//! All models implement [`PipelineEstimator`](ferrolearn_core::pipeline::PipelineEstimator)
//! for `f64`, allowing them to be used as the final step in a
//! [`Pipeline`](ferrolearn_core::pipeline::Pipeline).
//!
//! # Float Generics
//!
//! All models are generic over `F: num_traits::Float + Send + Sync + 'static`,
//! supporting both `f32` and `f64`.

pub mod adaboost;
pub mod decision_tree;
pub mod extra_tree;
pub mod extra_trees_ensemble;
pub mod gradient_boosting;
pub mod hist_gradient_boosting;
pub mod isolation_forest;
pub mod random_forest;
pub mod random_trees_embedding;
pub mod voting;

// Re-export the main types at the crate root.
pub use adaboost::{AdaBoostAlgorithm, AdaBoostClassifier, FittedAdaBoostClassifier};
pub use decision_tree::{
    ClassificationCriterion, DecisionTreeClassifier, DecisionTreeRegressor,
    FittedDecisionTreeClassifier, FittedDecisionTreeRegressor, Node, RegressionCriterion,
};
pub use extra_tree::{
    ExtraTreeClassifier, ExtraTreeRegressor, FittedExtraTreeClassifier, FittedExtraTreeRegressor,
};
pub use extra_trees_ensemble::{
    ExtraTreesClassifier, ExtraTreesRegressor, FittedExtraTreesClassifier,
    FittedExtraTreesRegressor,
};
pub use gradient_boosting::{
    ClassificationLoss, FittedGradientBoostingClassifier, FittedGradientBoostingRegressor,
    GradientBoostingClassifier, GradientBoostingRegressor, RegressionLoss,
};
pub use hist_gradient_boosting::{
    FittedHistGradientBoostingClassifier, FittedHistGradientBoostingRegressor,
    HistClassificationLoss, HistGradientBoostingClassifier, HistGradientBoostingRegressor,
    HistNode, HistRegressionLoss,
};
pub use isolation_forest::{FittedIsolationForest, IsolationForest};
pub use random_forest::{
    FittedRandomForestClassifier, FittedRandomForestRegressor, MaxFeatures, RandomForestClassifier,
    RandomForestRegressor,
};
pub use random_trees_embedding::{FittedRandomTreesEmbedding, RandomTreesEmbedding};
pub use voting::{
    FittedVotingClassifier, FittedVotingRegressor, VotingClassifier, VotingRegressor,
};