pub struct FittedMultiTaskLasso<F> { /* private fields */ }Expand description
Fitted multi-task Lasso regression model.
Stores the learned coefficient matrix (shape (n_tasks, n_features), the
sklearn coef_ layout), the per-task intercept vector, and the number of
block-coordinate-descent sweeps run. Implements Predict.
Implementations§
Source§impl<F: Float> FittedMultiTaskLasso<F>
impl<F: Float> FittedMultiTaskLasso<F>
Sourcepub fn coefficients(&self) -> &Array2<F>
pub fn coefficients(&self) -> &Array2<F>
Borrow the learned coefficient matrix, shape (n_tasks, n_features)
(sklearn coef_ layout).
Sourcepub fn intercepts(&self) -> &Array1<F>
pub fn intercepts(&self) -> &Array1<F>
Borrow the per-task intercept vector, length n_tasks (sklearn
intercept_).
Sourcepub fn n_iter(&self) -> usize
pub fn n_iter(&self) -> usize
Number of block-coordinate-descent sweeps run by the solver (sklearn
n_iter_).
Sourcepub fn dual_gap(&self) -> F
pub fn dual_gap(&self) -> F
Duality gap at the returned solution, on the (1 / (2 * n_samples))-scaled
objective.
Mirrors sklearn’s MultiTaskLasso.dual_gap_ attribute
(_coordinate_descent.py:2636 — unpacked from
enet_coordinate_descent_multi_task — then :2652
self.dual_gap_ /= n_samples, the final objective-scaling). This is the
final block-CD duality gap (the value that decided convergence), scaled by
1 / n_samples so the exposed value matches sklearn’s dual_gap_.
Trait Implementations§
Source§impl<F: Clone> Clone for FittedMultiTaskLasso<F>
impl<F: Clone> Clone for FittedMultiTaskLasso<F>
Source§fn clone(&self) -> FittedMultiTaskLasso<F>
fn clone(&self) -> FittedMultiTaskLasso<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 FittedMultiTaskLasso<F>
impl<F: Debug> Debug for FittedMultiTaskLasso<F>
Source§impl<F: Float + Send + Sync + ScalarOperand + 'static> Predict<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for FittedMultiTaskLasso<F>
impl<F: Float + Send + Sync + ScalarOperand + 'static> Predict<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for FittedMultiTaskLasso<F>
Source§fn predict(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
fn predict(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
Predict target values for the given feature matrix.
Computes pred[i, k] = sum_j X[i, j] * coef[k, j] + intercept[k], i.e.
X.dot(coef^T) + intercepts (broadcast per task column), returning an
(n_samples, n_tasks) array.
§Errors
Returns FerroError::ShapeMismatch if the number of features does not
match the fitted model.
Source§type Output = ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>
type Output = ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>
ndarray::Array1<F> or ndarray::Array1<usize>).Source§type Error = FerroError
type Error = FerroError
predict.Auto Trait Implementations§
impl<F> Freeze for FittedMultiTaskLasso<F>where
F: Freeze,
impl<F> RefUnwindSafe for FittedMultiTaskLasso<F>where
F: RefUnwindSafe,
impl<F> Send for FittedMultiTaskLasso<F>where
F: Send,
impl<F> Sync for FittedMultiTaskLasso<F>where
F: Sync,
impl<F> Unpin for FittedMultiTaskLasso<F>where
F: Unpin,
impl<F> UnsafeUnpin for FittedMultiTaskLasso<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for FittedMultiTaskLasso<F>where
F: UnwindSafe + RefUnwindSafe,
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