pub struct CompactTreeNode {
pub packed_data: u64,
pub value: f32,
pub left_child: u32,
pub right_child: u32,
}Expand description
Compact tree node representation for memory efficiency
Fields§
§packed_data: u64Compact node data packed into a single u64 Bits 0-15: feature index (16 bits, max 65535 features) Bits 16-47: threshold as f32 bits (32 bits) Bits 48-63: node flags and metadata (16 bits)
value: f32Prediction value for leaf nodes or impurity for split nodes
left_child: u32Left child index (0 means no left child)
right_child: u32Right child index (0 means no right child)
Implementations§
Source§impl CompactTreeNode
impl CompactTreeNode
Sourcepub fn new_split(feature_idx: u16, threshold: f32, impurity: f64) -> Self
pub fn new_split(feature_idx: u16, threshold: f32, impurity: f64) -> Self
Create a new split node
Sourcepub fn feature_idx(&self) -> u16
pub fn feature_idx(&self) -> u16
Get feature index for split nodes
Sourcepub fn prediction(&self) -> f64
pub fn prediction(&self) -> f64
Get prediction value for leaf nodes
Sourcepub fn set_left_child(&mut self, child_idx: u32)
pub fn set_left_child(&mut self, child_idx: u32)
Set left child index
Sourcepub fn set_right_child(&mut self, child_idx: u32)
pub fn set_right_child(&mut self, child_idx: u32)
Set right child index
Trait Implementations§
Source§impl Clone for CompactTreeNode
impl Clone for CompactTreeNode
Source§fn clone(&self) -> CompactTreeNode
fn clone(&self) -> CompactTreeNode
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 CompactTreeNode
impl RefUnwindSafe for CompactTreeNode
impl Send for CompactTreeNode
impl Sync for CompactTreeNode
impl Unpin for CompactTreeNode
impl UnwindSafe for CompactTreeNode
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