pub struct Tree {Show 19 fields
pub num_leaves: usize,
pub num_cat: usize,
pub split_feature: Vec<i32>,
pub split_gain: Vec<f32>,
pub threshold: Vec<f64>,
pub decision_type: Vec<i8>,
pub left_child: Vec<i32>,
pub right_child: Vec<i32>,
pub leaf_value: Vec<f64>,
pub leaf_weight: Vec<f64>,
pub leaf_count: Vec<i64>,
pub internal_value: Vec<f64>,
pub internal_weight: Vec<f64>,
pub internal_count: Vec<i64>,
pub cat_boundaries: Vec<i32>,
pub cat_threshold: Vec<u32>,
pub shrinkage: f64,
pub leaf_parent: Vec<i32>,
pub leaf_depth: Vec<i32>,
}Fields§
§num_leaves: usize§num_cat: usize§split_feature: Vec<i32>Input (real) feature index of each internal node.
split_gain: Vec<f32>§threshold: Vec<f64>Numerical: the value <= which goes left. Categorical: index into cat_boundaries.
decision_type: Vec<i8>§left_child: Vec<i32>§right_child: Vec<i32>§leaf_value: Vec<f64>§leaf_weight: Vec<f64>§leaf_count: Vec<i64>§internal_value: Vec<f64>§internal_weight: Vec<f64>§internal_count: Vec<i64>§cat_boundaries: Vec<i32>num_cat + 1 offsets into cat_threshold.
cat_threshold: Vec<u32>Bitsets of category values going left, 32 per word.
shrinkage: f64§leaf_parent: Vec<i32>Training only: each leaf’s parent node (-1 for the root).
leaf_depth: Vec<i32>Training only: each leaf’s depth (root 0).
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn leaf_index(&self, row: &[f64]) -> usize
pub fn leaf_index(&self, row: &[f64]) -> usize
The leaf row reaches, as Model::predict_raw_row walks it: row holds raw feature values (NaN missing).
Source§impl Tree
impl Tree
Sourcepub fn split_numerical(
&mut self,
leaf: usize,
feature: usize,
threshold: f64,
default_left: bool,
missing: MissingType,
children: &SplitChildren,
) -> usize
pub fn split_numerical( &mut self, leaf: usize, feature: usize, threshold: f64, default_left: bool, missing: MissingType, children: &SplitChildren, ) -> usize
Tree::Split for a numerical feature; returns the new (right) leaf’s index.
Sourcepub fn split_categorical(
&mut self,
leaf: usize,
feature: usize,
categories: &[i32],
missing: MissingType,
children: &SplitChildren,
) -> usize
pub fn split_categorical( &mut self, leaf: usize, feature: usize, categories: &[i32], missing: MissingType, children: &SplitChildren, ) -> usize
Tree::SplitCategorical: categories are the category values going left.
Sourcepub fn add_bias(&mut self, bias: f64)
pub fn add_bias(&mut self, bias: f64)
Tree::AddBias: folds the initial score into the first tree, whose shrinkage LightGBM then writes as 1.
Sourcepub fn as_constant(&mut self, value: f64)
pub fn as_constant(&mut self, value: f64)
Tree::AsConstantTree.
Sourcepub fn set_leaf_output(&mut self, leaf: usize, value: f64)
pub fn set_leaf_output(&mut self, leaf: usize, value: f64)
Tree::SetLeafOutput.
Trait Implementations§
impl StructuralPartialEq for Tree
Auto Trait Implementations§
impl Forget for Tree
impl Freeze for Tree
impl Move for Tree
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnsafeUnpin 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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