Skip to main content

Structural

Trait Structural 

Source
pub trait Structural: StreamingLearner {
    // Required methods
    fn apply_structural_change(&mut self, depth_delta: i32, steps_delta: i32);
    fn replacement_count(&self) -> u64;

    // Provided methods
    fn check_proactive_prune(&mut self) -> bool { ... }
    fn set_prune_half_life(&mut self, _hl: usize) { ... }
    fn tree_structure(&self) -> Vec<(usize, usize, f64, f64, u64)> { ... }
}
Available on crate feature alloc only.
Expand description

Models whose internal capacity can grow or shrink at runtime.

Implemented by tree ensemble models: SGBT, AdaptiveRandomForest, DistributionalSGBT, BaggedSGBT, stacked ensembles that delegate to trees.

§Object Safety

This trait is object-safe. Box<dyn Structural> is a legal type.

Required Methods§

Source

fn apply_structural_change(&mut self, depth_delta: i32, steps_delta: i32)

Apply depth/step changes that take effect at the next tree replacement.

  • depth_delta – signed adjustment to maximum tree depth (+1, -1, 0).
  • steps_delta – signed adjustment to ensemble step count (+2, -2, 0).
Source

fn replacement_count(&self) -> u64

Total number of internal model replacements since creation or last reset.

External callers use this counter to detect replacement boundaries and apply queued structural changes.

Provided Methods§

Source

fn check_proactive_prune(&mut self) -> bool

Manually trigger a proactive prune check.

Returns true if an internal component was pruned or replaced. Defaults to false (no-op) for models without proactive pruning.

Source

fn set_prune_half_life(&mut self, _hl: usize)

Dynamically set the contribution-accuracy EWMA half-life.

Recomputes prune_alpha so each correction batch contributes equally regardless of batch size. Default: no-op for models without an EWMA prune accumulator.

Source

fn tree_structure(&self) -> Vec<(usize, usize, f64, f64, u64)>

Per-tree structure diagnostics.

Returns one tuple per tree: (max_depth, n_leaves, leaf_weight_mean, leaf_weight_std, samples_seen). Defaults to an empty vec for models without tree diagnostics.

Implementors§