pub struct TreeNode {
pub feature_index: Option<usize>,
pub threshold: Option<f32>,
pub left: Option<Box<TreeNode>>,
pub right: Option<Box<TreeNode>>,
pub value: Option<f32>,
pub class_probs: Option<Vec<f32>>,
pub n_samples: usize,
pub impurity: f32,
}Expand description
A node in the decision tree
Fields§
§feature_index: Option<usize>Feature index for split
threshold: Option<f32>Threshold for split
left: Option<Box<TreeNode>>Left child
right: Option<Box<TreeNode>>Right child
value: Option<f32>Prediction value (for leaf nodes)
class_probs: Option<Vec<f32>>Class probabilities (for classification)
n_samples: usizeNumber of samples at this node
impurity: f32Impurity at this node
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TreeNode
impl RefUnwindSafe for TreeNode
impl Send for TreeNode
impl Sync for TreeNode
impl Unpin for TreeNode
impl UnwindSafe for TreeNode
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