pub trait Splitter {
    // Required methods
    fn get_constraint(&self, feature: &usize) -> Option<&Constraint>;
    fn get_gamma(&self) -> f32;
    fn get_l2(&self) -> f32;
    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,
        constraint: Option<&Constraint>
    ) -> Option<(NodeInfo, NodeInfo, MissingInfo)>;
    fn handle_split_info(
        &self,
        split_info: SplitInfo,
        n_nodes: &usize,
        node: &mut SplittableNode,
        index: &mut [usize],
        data: &Matrix<'_, u16>,
        cuts: &JaggedMatrix<f64>,
        grad: &[f32],
        hess: &[f32],
        parallel: bool
    ) -> Vec<SplittableNode>;

    // Provided methods
    fn best_split(&self, node: &SplittableNode) -> Option<SplitInfo> { ... }
    fn best_feature_split(
        &self,
        node: &SplittableNode,
        feature: usize
    ) -> Option<SplitInfo> { ... }
    fn split_node(
        &self,
        n_nodes: &usize,
        node: &mut SplittableNode,
        index: &mut [usize],
        data: &Matrix<'_, u16>,
        cuts: &JaggedMatrix<f64>,
        grad: &[f32],
        hess: &[f32],
        parallel: bool
    ) -> Vec<SplittableNode> { ... }
}

Required Methods§

source

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

source

fn get_gamma(&self) -> f32

source

fn get_l2(&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, 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], data: &Matrix<'_, u16>, cuts: &JaggedMatrix<f64>, grad: &[f32], hess: &[f32], parallel: bool ) -> Vec<SplittableNode>

Handle the split info, creating the children nodes, for the provided nodes push them onto the growable stack. Return a tuple, where the first value is the number of nodes pushed onto the growable stack, and the second value is the number of potential leaves that have been added.

Provided Methods§

source

fn best_split(&self, node: &SplittableNode) -> Option<SplitInfo>

source

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

source

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

Implementors§