Struct linfa_trees::TreeNode
source · pub struct TreeNode<F, L> { /* private fields */ }
Expand description
A node in the decision tree
Implementations§
source§impl<F: Float, L: Label + Debug> TreeNode<F, L>
impl<F: Float, L: Label + Debug> TreeNode<F, L>
sourcepub fn prediction(&self) -> Option<L>
pub fn prediction(&self) -> Option<L>
Returns Some(prediction)
for leaf nodes and None
for internal nodes.
sourcepub fn children(&self) -> Vec<&Option<Box<TreeNode<F, L>>>>
pub fn children(&self) -> Vec<&Option<Box<TreeNode<F, L>>>>
Returns both children, first left then right
sourcepub fn split(&self) -> (usize, F, F)
pub fn split(&self) -> (usize, F, F)
Return the split (feature index, value) and its impurity decrease
sourcepub fn feature_name(&self) -> Option<&String>
pub fn feature_name(&self) -> Option<&String>
Returns the name of the feature used in the split if the node is internal,
None
otherwise
Trait Implementations§
source§impl<F, L> PartialEq for TreeNode<F, L>
impl<F, L> PartialEq for TreeNode<F, L>
impl<F, L> Eq for TreeNode<F, L>
Auto Trait Implementations§
impl<F, L> RefUnwindSafe for TreeNode<F, L>where
F: RefUnwindSafe,
L: RefUnwindSafe,
impl<F, L> Send for TreeNode<F, L>
impl<F, L> Sync for TreeNode<F, L>
impl<F, L> Unpin for TreeNode<F, L>
impl<F, L> UnwindSafe for TreeNode<F, L>where
F: UnwindSafe,
L: UnwindSafe,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.