pub struct RandomForest { /* private fields */ }Expand description
A random forest: many decorrelated decision trees, each grown on a bootstrap resample of the
data and restricted to a random subset of features at every split (default √features), with
predictions made by averaging the trees’ class probabilities. Averaging cancels the variance
of the individual deep trees, so forests resist overfitting. The out-of-bag error (each tree
scored on the samples it never saw) gives a free generalisation estimate.
Implementations§
Source§impl RandomForest
impl RandomForest
pub fn new(trees: usize, max_depth: usize, seed: u64) -> Self
pub fn with_max_features(self, m: usize) -> Self
Sourcepub fn oob_accuracy(&self) -> Option<f64>
pub fn oob_accuracy(&self) -> Option<f64>
Accuracy on out-of-bag samples from the last fit, if every sample was out of bag at least once.
Sourcepub fn feature_importances(&self) -> &[f64]
pub fn feature_importances(&self) -> &[f64]
How often each feature is used for a split, normalised to sum to one.
pub fn predict_proba(&self, x: VR2D<'_>) -> Result<R2D, ErrorsJSL>
Trait Implementations§
Source§impl Classifier for RandomForest
impl Classifier for RandomForest
Source§impl Clone for RandomForest
impl Clone for RandomForest
Auto Trait Implementations§
impl Freeze for RandomForest
impl RefUnwindSafe for RandomForest
impl Send for RandomForest
impl Sync for RandomForest
impl Unpin for RandomForest
impl UnsafeUnpin for RandomForest
impl UnwindSafe for RandomForest
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