pub struct RidgeClassifier<F> {
pub alpha: F,
pub fit_intercept: bool,
}Expand description
Ridge Classifier.
Applies Ridge regression (L2-regularized least squares) to classification by converting labels to a binary indicator matrix.
§Type Parameters
F: The floating-point type (f32orf64).
Fields§
§alpha: FRegularization strength. Larger values specify stronger regularization.
fit_intercept: boolWhether to fit an intercept (bias) term.
Implementations§
Source§impl<F: Float> RidgeClassifier<F>
impl<F: Float> RidgeClassifier<F>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new RidgeClassifier with default settings.
Defaults: alpha = 1.0, fit_intercept = true.
Sourcepub fn with_alpha(self, alpha: F) -> Self
pub fn with_alpha(self, alpha: F) -> Self
Set the regularization strength.
Sourcepub fn with_fit_intercept(self, fit_intercept: bool) -> Self
pub fn with_fit_intercept(self, fit_intercept: bool) -> Self
Set whether to fit an intercept term.
Trait Implementations§
Source§impl<F: Clone> Clone for RidgeClassifier<F>
impl<F: Clone> Clone for RidgeClassifier<F>
Source§fn clone(&self) -> RidgeClassifier<F>
fn clone(&self) -> RidgeClassifier<F>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<F: Debug> Debug for RidgeClassifier<F>
impl<F: Debug> Debug for RidgeClassifier<F>
Source§impl<F: Float> Default for RidgeClassifier<F>
impl<F: Float> Default for RidgeClassifier<F>
Source§impl<F: Float + Send + Sync + ScalarOperand + FromPrimitive + 'static> Fit<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>>> for RidgeClassifier<F>
impl<F: Float + Send + Sync + ScalarOperand + FromPrimitive + 'static> Fit<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>>> for RidgeClassifier<F>
Source§fn fit(
&self,
x: &Array2<F>,
y: &Array1<usize>,
) -> Result<FittedRidgeClassifier<F>, FerroError>
fn fit( &self, x: &Array2<F>, y: &Array1<usize>, ) -> Result<FittedRidgeClassifier<F>, FerroError>
Fit the Ridge Classifier by converting labels to a binary indicator matrix and solving multivariate Ridge regression.
§Errors
FerroError::ShapeMismatch— sample count mismatch.FerroError::InvalidParameter— negative alpha.FerroError::InsufficientSamples— fewer than 2 classes.
Source§type Fitted = FittedRidgeClassifier<F>
type Fitted = FittedRidgeClassifier<F>
The fitted model type returned by
fit.Source§type Error = FerroError
type Error = FerroError
The error type returned by
fit.Auto Trait Implementations§
impl<F> Freeze for RidgeClassifier<F>where
F: Freeze,
impl<F> RefUnwindSafe for RidgeClassifier<F>where
F: RefUnwindSafe,
impl<F> Send for RidgeClassifier<F>where
F: Send,
impl<F> Sync for RidgeClassifier<F>where
F: Sync,
impl<F> Unpin for RidgeClassifier<F>where
F: Unpin,
impl<F> UnsafeUnpin for RidgeClassifier<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for RidgeClassifier<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
Mutably borrows from an owned value. Read more
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>
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