MissingImputerSplitter

Struct MissingImputerSplitter 

Source
pub struct MissingImputerSplitter {
    pub l1: f32,
    pub l2: f32,
    pub max_delta_step: f32,
    pub gamma: f32,
    pub min_leaf_weight: f32,
    pub learning_rate: f32,
    pub allow_missing_splits: bool,
    pub constraints_map: ConstraintMap,
}
Expand description

Missing imputer splitter Splitter that imputes missing values, by sending them down either the right or left branch, depending on which results in a higher increase in gain.

Fields§

§l1: f32§l2: f32§max_delta_step: f32§gamma: f32§min_leaf_weight: f32§learning_rate: f32§allow_missing_splits: bool§constraints_map: ConstraintMap

Implementations§

Source§

impl MissingImputerSplitter

Source

pub fn new( l1: f32, l2: f32, max_delta_step: f32, gamma: f32, min_leaf_weight: f32, learning_rate: f32, allow_missing_splits: bool, constraints_map: ConstraintMap, ) -> Self

Generate a new missing imputer splitter object.

Trait Implementations§

Source§

impl Splitter for MissingImputerSplitter

Source§

fn get_constraint(&self, feature: &usize) -> Option<&Constraint>

Source§

fn get_gamma(&self) -> f32

Source§

fn get_l1(&self) -> f32

Source§

fn get_l2(&self) -> f32

Source§

fn get_max_delta_step(&self) -> f32

Source§

fn get_learning_rate(&self) -> f32

Source§

fn evaluate_split( &self, left_gradient: f32, left_hessian: f32, right_gradient: f32, right_hessian: f32, missing_gradient: f32, missing_hessian: f32, lower_bound: f32, upper_bound: f32, _parent_weight: f32, constraint: Option<&Constraint>, ) -> Option<(NodeInfo, NodeInfo, MissingInfo)>

Evaluate a split, returning the node info for the left, and right splits, as well as the node info the missing data of a feature.
Source§

fn handle_split_info( &self, split_info: SplitInfo, n_nodes: &usize, node: &mut SplittableNode, index: &mut [usize], col_index: &[usize], data: &Matrix<'_, u16>, cuts: &JaggedMatrix<f64>, grad: &[f32], hess: &[f32], parallel: bool, ) -> Vec<SplittableNode>

Handle the split info, creating the children nodes, this function will return a vector of new splitable nodes, that can be added to the growable stack, and further split, or converted to leaf nodes.
Source§

fn new_leaves_added(&self) -> usize

When a split happens, how many leaves will the tree increase by? For example, if a binary split happens, the split will increase the number of leaves by 1, if a ternary split happens, the number of leaves will increase by 2.
Source§

fn clean_up_splits(&self, _tree: &mut Tree)

Perform any post processing on the tree that is relevant for the specific splitter, empty default implementation so that it can be called even if it’s not used.
Source§

fn best_split( &self, node: &SplittableNode, col_index: &[usize], ) -> Option<SplitInfo>

Find the best possible split, considering all feature histograms. If we wanted to add Column sampling, this is probably where we would need to do it, otherwise, it would be at the tree level.
Source§

fn best_feature_split( &self, node: &SplittableNode, feature: usize, idx: usize, ) -> Option<SplitInfo>

The idx is the index of the feature in the histogram data, whereas feature is the index of the actual feature in the data.
Source§

fn split_node( &self, n_nodes: &usize, node: &mut SplittableNode, index: &mut [usize], col_index: &[usize], data: &Matrix<'_, u16>, cuts: &JaggedMatrix<f64>, grad: &[f32], hess: &[f32], parallel: bool, ) -> Vec<SplittableNode>

Split the node, if we cant find a best split, we will need to return an empty vector, this node is a leaf.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V