Struct linfa_trees::TreeNode
source · [−]pub struct TreeNode<F, L> { /* private fields */ }Expand description
A node in the decision tree
Implementations
sourceimpl<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
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> where
F: Send,
L: Send,
impl<F, L> Sync for TreeNode<F, L> where
F: Sync,
L: Sync,
impl<F, L> Unpin for TreeNode<F, L> where
F: Unpin,
L: Unpin,
impl<F, L> UnwindSafe for TreeNode<F, L> where
F: UnwindSafe,
L: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more