pub struct DecisionTree<L, F>where
F: TreeFunction,{
pub params: TreeParameters,
/* private fields */
}
Expand description
A decision tree for prediction all kinds of thing a decision tree can predict.
A leaf of this tree contains data of type L
.
This tree uses a TreeFunction of Type F
.
Fields§
§params: TreeParameters
Implementations§
Source§impl<L, F> DecisionTree<L, F>where
F: TreeFunction,
impl<L, F> DecisionTree<L, F>where
F: TreeFunction,
Sourcepub fn predict<'a>(&'a self, input: &F::Data) -> Option<&'a L>
pub fn predict<'a>(&'a self, input: &F::Data) -> Option<&'a L>
Predict the output using the input
.
For doing that the input data will be tested using a binary feature of a node
and depending on the result the feature of the left or right child node will be
used for the next iteration. At the end there is a chosen leaf.
Returns the data of the leaf the interior features have chosen.
Returns None if the tree is invalid (e.g. no root-node).
Trait Implementations§
Source§impl<'de, L, F> Deserialize<'de> for DecisionTree<L, F>
impl<'de, L, F> Deserialize<'de> for DecisionTree<L, F>
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<L, F> Freeze for DecisionTree<L, F>
impl<L, F> RefUnwindSafe for DecisionTree<L, F>
impl<L, F> Send for DecisionTree<L, F>
impl<L, F> Sync for DecisionTree<L, F>
impl<L, F> Unpin for DecisionTree<L, F>
impl<L, F> UnwindSafe for DecisionTree<L, F>
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