pub struct GradientBoostingRegressor { /* private fields */ }Expand description
Gradient boosting for regression (squared error). Defaults match
scikit-learn’s GradientBoostingRegressor: 100 stages, learning rate 0.1,
depth-3 trees.
use dml_core::GradientBoostingRegressor;
let gb = GradientBoostingRegressor::new()
.n_estimators(300)
.learning_rate(0.05)
.max_depth(Some(4))
.subsample(0.8)
.seed(1);Implementations§
Source§impl GradientBoostingRegressor
impl GradientBoostingRegressor
pub fn new() -> Self
Sourcepub fn n_estimators(self, n: usize) -> Self
pub fn n_estimators(self, n: usize) -> Self
Number of boosting stages (default 100).
Sourcepub fn learning_rate(self, rate: f64) -> Self
pub fn learning_rate(self, rate: f64) -> Self
Shrinkage applied to every tree (default 0.1). Smaller values need more stages but usually generalise better.
Sourcepub fn max_depth(self, depth: Option<usize>) -> Self
pub fn max_depth(self, depth: Option<usize>) -> Self
Maximum depth of each tree (default 3); None for unlimited.
Sourcepub fn min_samples_split(self, n: usize) -> Self
pub fn min_samples_split(self, n: usize) -> Self
Minimum number of rows to split a node (default 2).
Sourcepub fn min_samples_leaf(self, n: usize) -> Self
pub fn min_samples_leaf(self, n: usize) -> Self
Minimum number of rows in each leaf (default 1).
Sourcepub fn max_features(self, m: MaxFeatures) -> Self
pub fn max_features(self, m: MaxFeatures) -> Self
Features considered per split (default: all).
Sourcepub fn subsample(self, fraction: f64) -> Self
pub fn subsample(self, fraction: f64) -> Self
Fraction of rows drawn (without replacement) for each stage (default 1.0); below 1 gives stochastic gradient boosting.
Sourcepub fn feature_importances(&self) -> Option<&Array1<f64>>
pub fn feature_importances(&self) -> Option<&Array1<f64>>
Total impurity reduction per feature over all trees (sums to one).
Trait Implementations§
Source§impl Clone for GradientBoostingRegressor
impl Clone for GradientBoostingRegressor
Source§impl Debug for GradientBoostingRegressor
impl Debug for GradientBoostingRegressor
Source§impl Default for GradientBoostingRegressor
impl Default for GradientBoostingRegressor
Source§impl Regressor for GradientBoostingRegressor
impl Regressor for GradientBoostingRegressor
fn fit(&mut self, x: ArrayView2<'_, f64>, y: ArrayView1<'_, f64>) -> Result<()>
Source§fn fit_weighted(
&mut self,
x: ArrayView2<'_, f64>,
y: ArrayView1<'_, f64>,
w: ArrayView1<'_, f64>,
) -> Result<()>
fn fit_weighted( &mut self, x: ArrayView2<'_, f64>, y: ArrayView1<'_, f64>, w: ArrayView1<'_, f64>, ) -> Result<()>
Fit minimising a
w-weighted loss (needed by the RLearner).
The default reports that weights are unsupported.fn predict(&self, x: ArrayView2<'_, f64>) -> Result<Array1<f64>>
fn fresh(&self) -> Box<dyn Regressor>
Auto Trait Implementations§
impl Freeze for GradientBoostingRegressor
impl RefUnwindSafe for GradientBoostingRegressor
impl Send for GradientBoostingRegressor
impl Sync for GradientBoostingRegressor
impl Unpin for GradientBoostingRegressor
impl UnsafeUnpin for GradientBoostingRegressor
impl UnwindSafe for GradientBoostingRegressor
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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