pub struct BaggingClassifier {
pub n_estimators: usize,
pub max_depth: Option<usize>,
pub max_samples: Option<f64>,
pub bootstrap: bool,
pub seed: u64,
}Expand description
Bagging (Bootstrap Aggregating) classifier parameters (unfitted state).
Trains an ensemble of decision tree classifiers, each on a bootstrap sample
of the data using the full feature set. Unlike RandomForestClassifier,
bagging does not perform random feature subsampling at the tree level –
every tree sees all features.
Predictions are made by majority vote across all trees.
Fields§
§n_estimators: usizeNumber of trees in the ensemble.
max_depth: Option<usize>Maximum depth of each tree.
max_samples: Option<f64>Fraction of samples to draw for each tree (with replacement when
bootstrap=true). If None, draws n_samples. Value in (0, 1].
bootstrap: boolWhether to use bootstrap sampling. Default: true.
seed: u64Random seed for reproducibility.
Implementations§
Source§impl BaggingClassifier
impl BaggingClassifier
Sourcepub fn new(n_estimators: usize) -> Self
pub fn new(n_estimators: usize) -> Self
Create a new BaggingClassifier with the given number of trees and default parameters.
pub fn with_max_depth(self, max_depth: Option<usize>) -> Self
pub fn with_max_samples(self, max_samples: Option<f64>) -> Self
pub fn with_bootstrap(self, bootstrap: bool) -> Self
pub fn with_seed(self, seed: u64) -> Self
Trait Implementations§
Source§impl Clone for BaggingClassifier
impl Clone for BaggingClassifier
Source§fn clone(&self) -> BaggingClassifier
fn clone(&self) -> BaggingClassifier
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BaggingClassifier
impl Debug for BaggingClassifier
Source§impl Default for BaggingClassifier
impl Default for BaggingClassifier
Source§impl<'de> Deserialize<'de> for BaggingClassifier
impl<'de> Deserialize<'de> for BaggingClassifier
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
Source§impl<F: Float> Fit<F> for BaggingClassifier
impl<F: Float> Fit<F> for BaggingClassifier
Auto Trait Implementations§
impl Freeze for BaggingClassifier
impl RefUnwindSafe for BaggingClassifier
impl Send for BaggingClassifier
impl Sync for BaggingClassifier
impl Unpin for BaggingClassifier
impl UnsafeUnpin for BaggingClassifier
impl UnwindSafe for BaggingClassifier
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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