pub struct CompactTree {
pub nodes: Vec<CompactTreeNode>,
pub feature_importances: Vec<f32>,
pub n_features: usize,
pub depth: usize,
}Expand description
Compact tree representation for memory efficiency
Fields§
§nodes: Vec<CompactTreeNode>Array of compact tree nodes
feature_importances: Vec<f32>Feature importance scores
n_features: usizeNumber of features
depth: usizeTree depth
Implementations§
Source§impl CompactTree
impl CompactTree
Sourcepub fn add_node(&mut self, node: CompactTreeNode) -> u32
pub fn add_node(&mut self, node: CompactTreeNode) -> u32
Add a new node and return its index
Sourcepub fn predict_single(&self, sample: &[f64]) -> Result<f64>
pub fn predict_single(&self, sample: &[f64]) -> Result<f64>
Predict a single sample
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Calculate memory usage in bytes
Trait Implementations§
Source§impl Clone for CompactTree
impl Clone for CompactTree
Source§fn clone(&self) -> CompactTree
fn clone(&self) -> CompactTree
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CompactTree
impl RefUnwindSafe for CompactTree
impl Send for CompactTree
impl Sync for CompactTree
impl Unpin for CompactTree
impl UnwindSafe for CompactTree
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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