pub enum LeafModelType {
ClosedForm,
Linear {
learning_rate: f64,
decay: Option<f64>,
use_adagrad: bool,
},
MLP {
hidden_size: usize,
learning_rate: f64,
decay: Option<f64>,
},
Adaptive {
promote_to: Box<LeafModelType>,
},
}Expand description
Describes which leaf model architecture to use.
Used by tree builders to construct fresh leaf models when creating new leaves.
§Variants
ClosedForm– Standard constant leaf weight. Zero overhead (default).Linear– Per-leaf online ridge regression with AdaGrad optimization. Each leaf learns a local linear surfacew . x + b. Recommended for low-depth trees (depth 2–4). Optionaldecayfor concept drift.MLP– Per-leaf single-hidden-layer neural network with ReLU. Optionaldecayfor concept drift.Adaptive– Starts as closed-form, auto-promotes topromote_towhen the Hoeffding bound confirms it is statistically superior. Uses the tree’s existingdeltaparameter – no arbitrary thresholds.
Variants§
ClosedForm
Standard closed-form leaf weight.
Linear
Online ridge regression, optionally with AdaGrad optimization.
decay: optional exponential weight decay for non-stationary streams.
Typical values: 0.999 (slow drift) to 0.99 (fast drift).
use_adagrad: when true, per-weight squared gradient accumulators
give each feature its own adaptive learning rate. When false
(default), all weights share a single Newton-scaled learning rate.
MLP
Single hidden layer MLP with the given hidden size and learning rate.
decay: optional exponential weight decay for non-stationary streams.
Adaptive
Adaptive leaf that starts as closed-form and auto-promotes when the Hoeffding bound confirms the promoted model is better.
The promote_to field specifies the shadow model type to evaluate
against the default closed-form baseline.
Fields
promote_to: Box<LeafModelType>Implementations§
Source§impl LeafModelType
impl LeafModelType
Sourcepub fn create(&self, seed: u64, delta: f64) -> Box<dyn LeafModel>
pub fn create(&self, seed: u64, delta: f64) -> Box<dyn LeafModel>
Create a fresh boxed leaf model of this type.
The seed parameter controls deterministic initialization (MLP weights,
adaptive model seeding). The delta parameter is the Hoeffding bound
confidence level, used by Adaptive leaves
for promotion decisions. For non-adaptive types, delta is unused.
Trait Implementations§
Source§impl Clone for LeafModelType
impl Clone for LeafModelType
Source§fn clone(&self) -> LeafModelType
fn clone(&self) -> LeafModelType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LeafModelType
impl Debug for LeafModelType
Source§impl Default for LeafModelType
impl Default for LeafModelType
Source§fn default() -> LeafModelType
fn default() -> LeafModelType
Source§impl<'de> Deserialize<'de> for LeafModelType
impl<'de> Deserialize<'de> for LeafModelType
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for LeafModelType
impl PartialEq for LeafModelType
Source§impl Serialize for LeafModelType
impl Serialize for LeafModelType
impl StructuralPartialEq for LeafModelType
Auto Trait Implementations§
impl Freeze for LeafModelType
impl RefUnwindSafe for LeafModelType
impl Send for LeafModelType
impl Sync for LeafModelType
impl Unpin for LeafModelType
impl UnsafeUnpin for LeafModelType
impl UnwindSafe for LeafModelType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more