pub struct LassoLars<F> {
pub alpha: F,
pub max_iter: usize,
pub fit_intercept: bool,
}Expand description
Fields§
§alpha: FL1 regularization strength. Larger values produce sparser models.
max_iter: usizeMaximum number of forward steps.
fit_intercept: boolWhether to fit an intercept (bias) term.
Implementations§
Source§impl<F: Float> LassoLars<F>
impl<F: Float> LassoLars<F>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new LassoLars with default settings.
Defaults: alpha = 1.0, max_iter = 500, fit_intercept = true.
Sourcepub fn with_alpha(self, alpha: F) -> Self
pub fn with_alpha(self, alpha: F) -> Self
Set the L1 regularization strength.
Sourcepub fn with_max_iter(self, max_iter: usize) -> Self
pub fn with_max_iter(self, max_iter: usize) -> Self
Set the maximum number of forward steps.
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: Float + Send + Sync + ScalarOperand + FromPrimitive + 'static> Fit<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<F>, Dim<[usize; 1]>>> for LassoLars<F>
impl<F: Float + Send + Sync + ScalarOperand + FromPrimitive + 'static> Fit<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<F>, Dim<[usize; 1]>>> for LassoLars<F>
Source§fn fit(
&self,
x: &Array2<F>,
y: &Array1<F>,
) -> Result<FittedLassoLars<F>, FerroError>
fn fit( &self, x: &Array2<F>, y: &Array1<F>, ) -> Result<FittedLassoLars<F>, FerroError>
Fit the Lasso-LARS model.
Like LARS, but features whose coefficients cross zero during the OLS
step are removed from the active set, enforcing an implicit L1
penalty. The iteration stops when the maximum absolute correlation
with the residual drops below alpha.
§Errors
FerroError::ShapeMismatch— sample count mismatch.FerroError::InsufficientSamples— zero samples.FerroError::InvalidParameter—alphais negative.
Source§type Fitted = FittedLassoLars<F>
type Fitted = FittedLassoLars<F>
The fitted model type returned by
fit.Source§type Error = FerroError
type Error = FerroError
The error type returned by
fit.Source§impl<F> PipelineEstimator<F> for LassoLars<F>
impl<F> PipelineEstimator<F> for LassoLars<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>
Fit this estimator on the given data. Read more
Auto Trait Implementations§
impl<F> Freeze for LassoLars<F>where
F: Freeze,
impl<F> RefUnwindSafe for LassoLars<F>where
F: RefUnwindSafe,
impl<F> Send for LassoLars<F>where
F: Send,
impl<F> Sync for LassoLars<F>where
F: Sync,
impl<F> Unpin for LassoLars<F>where
F: Unpin,
impl<F> UnsafeUnpin for LassoLars<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for LassoLars<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