pub struct MultiTaskLasso<F> {
pub alpha: F,
pub fit_intercept: bool,
pub max_iter: usize,
pub tol: F,
}Expand description
Multi-task Lasso regression (joint multi-output L2,1-regularized least squares).
Fits all target columns jointly under a group-Lasso (L2,1) penalty, so each
feature is either active for all tasks or zero for all of them. Mirrors
sklearn.linear_model.MultiTaskLasso
(_coordinate_descent.py:2663).
§Type Parameters
F: The floating-point type (f32orf64).
Fields§
§alpha: FRegularization strength on the L2,1 penalty. Larger values specify stronger regularization and zero out more whole feature rows.
fit_intercept: boolWhether to fit a per-task intercept (bias) term.
max_iter: usizeMaximum number of block-coordinate-descent iterations.
tol: FConvergence tolerance on the relative coefficient change / dual gap.
Implementations§
Source§impl<F: Float> MultiTaskLasso<F>
impl<F: Float> MultiTaskLasso<F>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new MultiTaskLasso with default settings.
Defaults: alpha = 1.0, fit_intercept = true, max_iter = 1000,
tol = 1e-4 — mirroring sklearn’s ctor defaults
MultiTaskLasso(alpha=1.0, fit_intercept=True, max_iter=1000, tol=1e-4)
(_coordinate_descent.py:2663).
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 per-task intercept terms.
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 iterations.
Trait Implementations§
Source§impl<F: Clone> Clone for MultiTaskLasso<F>
impl<F: Clone> Clone for MultiTaskLasso<F>
Source§fn clone(&self) -> MultiTaskLasso<F>
fn clone(&self) -> MultiTaskLasso<F>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<F: Debug> Debug for MultiTaskLasso<F>
impl<F: Debug> Debug for MultiTaskLasso<F>
Source§impl<F: Float> Default for MultiTaskLasso<F>
impl<F: Float> Default for MultiTaskLasso<F>
Source§impl<F: Float + Send + Sync + ScalarOperand + FromPrimitive + 'static> Fit<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for MultiTaskLasso<F>
impl<F: Float + Send + Sync + ScalarOperand + FromPrimitive + 'static> Fit<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for MultiTaskLasso<F>
Source§fn fit(
&self,
x: &Array2<F>,
y: &Array2<F>,
) -> Result<FittedMultiTaskLasso<F>, FerroError>
fn fit( &self, x: &Array2<F>, y: &Array2<F>, ) -> Result<FittedMultiTaskLasso<F>, FerroError>
Fit the multi-task Lasso model using block coordinate descent.
Ports sklearn’s enet_coordinate_descent_multi_task
(_cd_fast.pyx:740) with l2_reg = 0 and l1_reg = alpha * n_samples.
§Errors
Returns FerroError::ShapeMismatch if Y.nrows() differs from the
number of samples in X.
Returns FerroError::InvalidParameter if alpha is negative.
Returns FerroError::InsufficientSamples if there are no samples.
Returns FerroError::NumericalInstability if a required float constant
or column mean cannot be formed.
Source§type Fitted = FittedMultiTaskLasso<F>
type Fitted = FittedMultiTaskLasso<F>
fit.Source§type Error = FerroError
type Error = FerroError
fit.Auto Trait Implementations§
impl<F> Freeze for MultiTaskLasso<F>where
F: Freeze,
impl<F> RefUnwindSafe for MultiTaskLasso<F>where
F: RefUnwindSafe,
impl<F> Send for MultiTaskLasso<F>where
F: Send,
impl<F> Sync for MultiTaskLasso<F>where
F: Sync,
impl<F> Unpin for MultiTaskLasso<F>where
F: Unpin,
impl<F> UnsafeUnpin for MultiTaskLasso<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for MultiTaskLasso<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,
impl<T, U> Imply<T> for U
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