pub struct Tree {
pub nodes: Vec<Node>,
}Fields§
§nodes: Vec<Node>Implementations§
Source§impl Tree
impl Tree
pub fn new() -> Self
pub fn fit<T: Splitter>( &mut self, data: &Matrix<'_, u16>, index: Vec<usize>, col_index: &[usize], cuts: &JaggedMatrix<f64>, grad: &[f32], hess: &[f32], splitter: &T, max_leaves: usize, max_depth: usize, parallel: bool, sample_method: &SampleMethod, grow_policy: &GrowPolicy, )
pub fn predict_contributions_row_probability_change( &self, row: &[f64], contribs: &mut [f64], missing: &f64, current_logodds: f64, ) -> f64
pub fn predict_contributions_row_midpoint_difference( &self, row: &[f64], contribs: &mut [f64], missing: &f64, )
pub fn predict_contributions_row_branch_difference( &self, row: &[f64], contribs: &mut [f64], missing: &f64, )
pub fn predict_contributions_row_mode_difference( &self, row: &[f64], contribs: &mut [f64], missing: &f64, )
pub fn predict_contributions_row_weight( &self, row: &[f64], contribs: &mut [f64], missing: &f64, )
pub fn predict_contributions_weight( &self, data: &Matrix<'_, f64>, contribs: &mut [f64], missing: &f64, )
Sourcepub fn predict_contributions_row_average(
&self,
row: &[f64],
contribs: &mut [f64],
weights: &[f64],
missing: &f64,
)
pub fn predict_contributions_row_average( &self, row: &[f64], contribs: &mut [f64], weights: &[f64], missing: &f64, )
This is the method that XGBoost uses.
pub fn predict_contributions_average( &self, data: &Matrix<'_, f64>, contribs: &mut [f64], weights: &[f64], missing: &f64, )
pub fn predict_row_from_row_slice(&self, row: &[f64], missing: &f64) -> f64
pub fn predict( &self, data: &Matrix<'_, f64>, parallel: bool, missing: &f64, ) -> Vec<f64>
pub fn predict_leaf_indices( &self, data: &Matrix<'_, f64>, missing: &f64, ) -> Vec<usize>
pub fn value_partial_dependence( &self, feature: usize, value: f64, missing: &f64, ) -> f64
pub fn distribute_leaf_weights(&self) -> Vec<f64>
pub fn get_average_leaf_weights(&self, i: usize) -> f64
pub fn calculate_importance_weight( &self, stats: &mut HashMap<usize, (f32, usize)>, )
pub fn calculate_importance_gain( &self, stats: &mut HashMap<usize, (f32, usize)>, )
pub fn calculate_importance_cover( &self, stats: &mut HashMap<usize, (f32, usize)>, )
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tree
impl<'de> Deserialize<'de> for Tree
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 Freeze for Tree
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnwindSafe for Tree
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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