pub struct FittedVotingClassifier<F> { /* private fields */ }Expand description
A fitted voting ensemble classifier.
Stores the individually fitted decision trees and aggregates their predictions by majority vote.
Implementations§
Source§impl<F: Float + Send + Sync + 'static> FittedVotingClassifier<F>
impl<F: Float + Send + Sync + 'static> FittedVotingClassifier<F>
Sourcepub fn n_estimators(&self) -> usize
pub fn n_estimators(&self) -> usize
Returns the number of trees in the ensemble.
Sourcepub fn score(&self, x: &Array2<F>, y: &Array1<usize>) -> Result<F, FerroError>
pub fn score(&self, x: &Array2<F>, y: &Array1<usize>) -> Result<F, FerroError>
Mean accuracy on the given test data and labels.
Equivalent to sklearn’s ClassifierMixin.score.
§Errors
Returns FerroError::ShapeMismatch if x.nrows() != y.len() or
the feature count does not match the training data.
Sourcepub fn predict_proba(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
pub fn predict_proba(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
Predict class probabilities by averaging the per-tree
predict_proba outputs (sklearn’s voting='soft' semantics).
Returns shape (n_samples, n_classes). Each row sums to 1.
§Errors
Returns FerroError::ShapeMismatch if the number of features
does not match the fitted model.
Sourcepub fn predict_log_proba(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
pub fn predict_log_proba(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
Element-wise log of predict_proba. Mirrors
sklearn’s ClassifierMixin.predict_log_proba.
§Errors
Forwards any error from predict_proba.
Trait Implementations§
Source§impl<F: Clone> Clone for FittedVotingClassifier<F>
impl<F: Clone> Clone for FittedVotingClassifier<F>
Source§fn clone(&self) -> FittedVotingClassifier<F>
fn clone(&self) -> FittedVotingClassifier<F>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<F: Debug> Debug for FittedVotingClassifier<F>
impl<F: Debug> Debug for FittedVotingClassifier<F>
Source§impl<F: Float + Send + Sync + 'static> HasClasses for FittedVotingClassifier<F>
impl<F: Float + Send + Sync + 'static> HasClasses for FittedVotingClassifier<F>
Source§impl<F: Float + Send + Sync + 'static> Predict<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for FittedVotingClassifier<F>
impl<F: Float + Send + Sync + 'static> Predict<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for FittedVotingClassifier<F>
Source§fn predict(&self, x: &Array2<F>) -> Result<Array1<usize>, FerroError>
fn predict(&self, x: &Array2<F>) -> Result<Array1<usize>, FerroError>
Predict class labels by majority vote across all trees.
§Errors
Returns FerroError::ShapeMismatch if the number of features does
not match the fitted model.
Source§type Output = ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>>
type Output = ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>>
ndarray::Array1<F> or ndarray::Array1<usize>).Source§type Error = FerroError
type Error = FerroError
predict.Auto Trait Implementations§
impl<F> Freeze for FittedVotingClassifier<F>
impl<F> RefUnwindSafe for FittedVotingClassifier<F>where
F: RefUnwindSafe,
impl<F> Send for FittedVotingClassifier<F>where
F: Send,
impl<F> Sync for FittedVotingClassifier<F>where
F: Sync,
impl<F> Unpin for FittedVotingClassifier<F>where
F: Unpin,
impl<F> UnsafeUnpin for FittedVotingClassifier<F>
impl<F> UnwindSafe for FittedVotingClassifier<F>where
F: RefUnwindSafe + UnwindSafe,
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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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