pub struct AdaBoostClassifier<F> {
pub n_estimators: usize,
pub learning_rate: f64,
pub algorithm: AdaBoostAlgorithm,
pub random_state: Option<u64>,
/* private fields */
}Expand description
AdaBoost classifier using decision tree stumps as base estimators.
At each boosting round a decision tree stump (max depth = 1) is fitted to the weighted training data. Misclassified samples receive higher weight in subsequent rounds, allowing the ensemble to focus on hard examples.
§Type Parameters
F: The floating-point type (f32orf64).
Fields§
§n_estimators: usizeNumber of boosting stages (stumps).
learning_rate: f64Learning rate (shrinkage). Lower values require more estimators.
algorithm: AdaBoostAlgorithmAlgorithm variant (SAMME or SAMME.R).
random_state: Option<u64>Random seed for reproducibility.
Implementations§
Source§impl<F: Float> AdaBoostClassifier<F>
impl<F: Float> AdaBoostClassifier<F>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new AdaBoostClassifier with default settings.
Defaults: n_estimators = 50, learning_rate = 1.0,
algorithm = SAMME.R, random_state = None.
Sourcepub fn with_n_estimators(self, n: usize) -> Self
pub fn with_n_estimators(self, n: usize) -> Self
Set the number of boosting stages.
Sourcepub fn with_learning_rate(self, lr: f64) -> Self
pub fn with_learning_rate(self, lr: f64) -> Self
Set the learning rate.
Sourcepub fn with_algorithm(self, algo: AdaBoostAlgorithm) -> Self
pub fn with_algorithm(self, algo: AdaBoostAlgorithm) -> Self
Set the algorithm variant.
Sourcepub fn with_random_state(self, seed: u64) -> Self
pub fn with_random_state(self, seed: u64) -> Self
Set the random seed for reproducibility.
Trait Implementations§
Source§impl<F: Clone> Clone for AdaBoostClassifier<F>
impl<F: Clone> Clone for AdaBoostClassifier<F>
Source§fn clone(&self) -> AdaBoostClassifier<F>
fn clone(&self) -> AdaBoostClassifier<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 AdaBoostClassifier<F>
impl<F: Debug> Debug for AdaBoostClassifier<F>
Source§impl<F: Float> Default for AdaBoostClassifier<F>
impl<F: Float> Default for AdaBoostClassifier<F>
Source§impl<F: Float + Send + Sync + 'static> Fit<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>>> for AdaBoostClassifier<F>
impl<F: Float + Send + Sync + 'static> Fit<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>>> for AdaBoostClassifier<F>
Source§fn fit(
&self,
x: &Array2<F>,
y: &Array1<usize>,
) -> Result<FittedAdaBoostClassifier<F>, FerroError>
fn fit( &self, x: &Array2<F>, y: &Array1<usize>, ) -> Result<FittedAdaBoostClassifier<F>, FerroError>
Fit the AdaBoost classifier.
§Errors
Returns FerroError::ShapeMismatch if x and y have different
numbers of samples.
Returns FerroError::InsufficientSamples if there are no samples.
Returns FerroError::InvalidParameter for invalid hyperparameters.
Source§type Fitted = FittedAdaBoostClassifier<F>
type Fitted = FittedAdaBoostClassifier<F>
fit.Source§type Error = FerroError
type Error = FerroError
fit.Source§impl<F: Float + ToPrimitive + FromPrimitive + Send + Sync + 'static> PipelineEstimator<F> for AdaBoostClassifier<F>
impl<F: Float + ToPrimitive + FromPrimitive + Send + Sync + 'static> PipelineEstimator<F> for AdaBoostClassifier<F>
Source§fn fit_pipeline(
&self,
x: &Array2<F>,
y: &Array1<F>,
) -> Result<Box<dyn FittedPipelineEstimator<F>>, FerroError>
fn fit_pipeline( &self, x: &Array2<F>, y: &Array1<F>, ) -> Result<Box<dyn FittedPipelineEstimator<F>>, FerroError>
Auto Trait Implementations§
impl<F> Freeze for AdaBoostClassifier<F>
impl<F> RefUnwindSafe for AdaBoostClassifier<F>where
F: RefUnwindSafe,
impl<F> Send for AdaBoostClassifier<F>where
F: Send,
impl<F> Sync for AdaBoostClassifier<F>where
F: Sync,
impl<F> Unpin for AdaBoostClassifier<F>where
F: Unpin,
impl<F> UnsafeUnpin for AdaBoostClassifier<F>
impl<F> UnwindSafe for AdaBoostClassifier<F>where
F: 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