pub enum BinMapper {
Numerical {
upper_bounds: Vec<f64>,
nan_bin: bool,
min: f64,
max: f64,
},
Categorical {
categories: Vec<i32>,
},
Trivial,
}Variants§
Implementations§
Source§impl BinMapper
impl BinMapper
Sourcepub fn numerical(
sample: &[f64],
total_rows: usize,
params: &Params,
) -> BinMapper
pub fn numerical( sample: &[f64], total_rows: usize, params: &Params, ) -> BinMapper
Builds a numerical mapper from sampled values (NaN included) out of total_rows sampled rows; sampled rows
missing from sample are zeros, as in LightGBM’s sparse sample.
Sourcepub fn categorical(
sample: &[f64],
total_rows: usize,
params: &Params,
) -> BinMapper
pub fn categorical( sample: &[f64], total_rows: usize, params: &Params, ) -> BinMapper
Builds a categorical mapper from sampled values out of total_rows sampled rows (absent rows are category 0),
following FindBin’s categorical branch: negative (after truncation to int) and NaN values are “other”; the
rest, by count descending then value ascending, become bins while they cover less than 99% of the sample or
fewer than max_bin bins are used, stopping at the third category with fewer than min_data_in_bin samples.
Sourcepub fn num_bins(&self) -> u32
pub fn num_bins(&self) -> u32
Bins in the histogram, NaN or “other” bin included; 0 when trivial.
Sourcepub fn value_to_bin(&self, value: f64) -> u8
pub fn value_to_bin(&self, value: f64) -> u8
LightGBM BinMapper::ValueToBin.
Sourcepub fn info_string(&self) -> String
pub fn info_string(&self) -> String
The feature_infos entry LightGBM writes: [min:max] (%.17g), -1:c1:c2:... (LightGBM lists its “other”
bin as category -1) or none.
Trait Implementations§
impl StructuralPartialEq for BinMapper
Auto Trait Implementations§
impl Forget for BinMapper
impl Freeze for BinMapper
impl Move for BinMapper
impl RefUnwindSafe for BinMapper
impl Send for BinMapper
impl Sync for BinMapper
impl Unpin for BinMapper
impl UnsafeUnpin for BinMapper
impl UnwindSafe for BinMapper
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
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> ⓘ
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> ⓘ
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