pub struct RandomForestClassifier {
pub n_estimators: usize,
pub max_depth: Option<usize>,
pub min_samples_split: usize,
pub min_samples_leaf: usize,
pub max_features: Option<usize>,
pub criterion: SplitCriterion,
pub bootstrap: bool,
pub max_samples: Option<f64>,
pub class_weight: Option<ClassWeight>,
pub oob_score: bool,
pub seed: u64,
}Expand description
Random forest classifier parameters (unfitted state).
Trains an ensemble of decision tree classifiers, each on a bootstrap sample of the data with an optional random subset of features.
Fields§
§n_estimators: usizeNumber of trees in the forest.
max_depth: Option<usize>Maximum depth of each tree.
min_samples_split: usizeMinimum samples required to split a node.
min_samples_leaf: usizeMinimum samples required in a leaf node.
max_features: Option<usize>Number of features to consider per tree. If None, all features are used.
criterion: SplitCriterionSplit criterion for each tree. Default: Gini.
bootstrap: boolWhether to use bootstrap sampling. Default: true.
max_samples: Option<f64>Fraction of samples to draw for each tree (when bootstrap=true).
If None, draws n_samples (with replacement). Value in (0, 1].
class_weight: Option<ClassWeight>Class weight strategy passed to each tree.
oob_score: boolWhether to compute out-of-bag score after fitting.
seed: u64Random seed for reproducibility.
Implementations§
Source§impl RandomForestClassifier
impl RandomForestClassifier
Sourcepub fn new(n_estimators: usize) -> Self
pub fn new(n_estimators: usize) -> Self
Create a new RandomForestClassifier with the given number of trees and default parameters.
pub fn with_max_depth(self, max_depth: Option<usize>) -> Self
pub fn with_min_samples_split(self, min_samples_split: usize) -> Self
pub fn with_min_samples_leaf(self, min_samples_leaf: usize) -> Self
pub fn with_max_features(self, max_features: Option<usize>) -> Self
pub fn with_criterion(self, criterion: SplitCriterion) -> Self
pub fn with_bootstrap(self, bootstrap: bool) -> Self
pub fn with_max_samples(self, max_samples: Option<f64>) -> Self
pub fn with_class_weight(self, class_weight: Option<ClassWeight>) -> Self
pub fn with_oob_score(self, oob_score: bool) -> Self
pub fn with_seed(self, seed: u64) -> Self
Trait Implementations§
Source§impl Clone for RandomForestClassifier
impl Clone for RandomForestClassifier
Source§fn clone(&self) -> RandomForestClassifier
fn clone(&self) -> RandomForestClassifier
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RandomForestClassifier
impl Debug for RandomForestClassifier
Source§impl Default for RandomForestClassifier
impl Default for RandomForestClassifier
Source§impl<'de> Deserialize<'de> for RandomForestClassifier
impl<'de> Deserialize<'de> for RandomForestClassifier
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>,
Source§impl<F: Float> Fit<F> for RandomForestClassifier
impl<F: Float> Fit<F> for RandomForestClassifier
Auto Trait Implementations§
impl Freeze for RandomForestClassifier
impl RefUnwindSafe for RandomForestClassifier
impl Send for RandomForestClassifier
impl Sync for RandomForestClassifier
impl Unpin for RandomForestClassifier
impl UnsafeUnpin for RandomForestClassifier
impl UnwindSafe for RandomForestClassifier
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
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>
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