pub struct TreeNode {
pub feature_index: Option<usize>,
pub threshold: Option<f64>,
pub prediction: f64,
pub class_probs: Option<Vec<f64>>,
pub left_child: Option<usize>,
pub right_child: Option<usize>,
pub n_samples: usize,
pub impurity: f64,
pub depth: usize,
pub is_leaf: bool,
}Expand description
A node in the decision tree
Fields§
§feature_index: Option<usize>Feature index used for splitting
threshold: Option<f64>Threshold for the split
prediction: f64Prediction value (for leaf nodes)
class_probs: Option<Vec<f64>>Class probabilities (for classification)
left_child: Option<usize>Left child node index
right_child: Option<usize>Right child node index
n_samples: usizeNumber of samples at this node
impurity: f64Impurity at this node
depth: usizeDepth of this node
is_leaf: boolWhether this is a leaf node
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TreeNode
impl<'de> Deserialize<'de> for TreeNode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TreeNode
impl RefUnwindSafe for TreeNode
impl Send for TreeNode
impl Sync for TreeNode
impl Unpin for TreeNode
impl UnsafeUnpin 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