Skip to main content

predict_tree

Function predict_tree 

Source
pub fn predict_tree(nodes: &[PackedNode], features: &[f32]) -> f32
Expand description

Traverse a single tree and return the leaf prediction value.

§Safety contract (upheld by EnsembleView::from_bytes)

  • All node child indices are within nodes.len().
  • All feature indices are within features.len().
  • The tree is acyclic and every path terminates at a leaf.

These invariants are validated once during EnsembleView::from_bytes(). After validation, traversal uses get_unchecked for zero-overhead indexing.