pub struct DecisionTreeClassifier { /* private fields */ }
Implementations§
Source§impl DecisionTreeClassifier
impl DecisionTreeClassifier
Sourcepub fn new(
max_depth: usize,
samples_split: usize,
metric_function: fn(x: NDArray<f64>) -> f64,
) -> DecisionTreeClassifier
pub fn new( max_depth: usize, samples_split: usize, metric_function: fn(x: NDArray<f64>) -> f64, ) -> DecisionTreeClassifier
Create instance of decision tree classifier
Sourcepub fn build_tree(&self, features: &NDArray<f64>, curr_depth: usize) -> Node
pub fn build_tree(&self, features: &NDArray<f64>, curr_depth: usize) -> Node
Build decision tree classifier
Sourcepub fn best_split(&self, features: NDArray<f64>) -> (f64, usize, f64)
pub fn best_split(&self, features: NDArray<f64>) -> (f64, usize, f64)
Find optimal split for decision tree classifier
Sourcepub fn information_gain(
&self,
feature: NDArray<f64>,
left: NDArray<f64>,
right: NDArray<f64>,
) -> f64
pub fn information_gain( &self, feature: NDArray<f64>, left: NDArray<f64>, right: NDArray<f64>, ) -> f64
Calculate information gain for decision tree classifier
Sourcepub fn select_max_class(&self, target: NDArray<f64>) -> f64
pub fn select_max_class(&self, target: NDArray<f64>) -> f64
Select highest probability class from target output
Sourcepub fn fit(&mut self, features: &NDArray<f64>, _target: &NDArray<f64>)
pub fn fit(&mut self, features: &NDArray<f64>, _target: &NDArray<f64>)
Fit decision tree classifier to features and target
Sourcepub fn prediction(&self, inputs: NDArray<f64>, node: Node) -> f64
pub fn prediction(&self, inputs: NDArray<f64>, node: Node) -> f64
Generate prediction for row sample of decision tree classifier
Sourcepub fn predict(&self, input: NDArray<f64>) -> NDArray<f64>
pub fn predict(&self, input: NDArray<f64>) -> NDArray<f64>
Generate prediction for all row samples for decision tree classification
Auto Trait Implementations§
impl Freeze for DecisionTreeClassifier
impl !RefUnwindSafe for DecisionTreeClassifier
impl !Send for DecisionTreeClassifier
impl !Sync for DecisionTreeClassifier
impl Unpin for DecisionTreeClassifier
impl !UnwindSafe for DecisionTreeClassifier
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