Shrinkage

shrinkage::LassoFit

Shrinkage for Rust · rust · 0.3.0

pub struct LassoFit

Owned original-scale parameters, preprocessing metadata, and diagnostics.

Check Self::termination before treating a fit as converged. Diagnostics refer to the optimization-scale penalty even though coefficients use the original scale.

Inherent implementation

impl LassoFit

coefficients

pub fn coefficients(&self) -> &[f64]

Original-scale coefficients, in training-column order.

dual_certificate

pub fn dual_certificate(&self) -> &[f64]

Feasible dual vector theta, with ||X_tilde' theta||_inf <= lambda and sum(theta) = 0 when an intercept was fitted, up to floating-point error. At zero penalty, the certificate can be zero and its gap can be loose.

dual_objective

pub fn dual_objective(&self) -> f64

Gaussian dual objective D(theta) = y' theta - n ||theta||² / 2.

duality_gap

pub fn duality_gap(&self) -> f64

Nonnegative gap G(beta_0, beta, theta) = P(beta_0, beta) - D(theta).

intercept

pub fn intercept(&self) -> f64

Original-scale intercept, including the correction for centering.

iterations

pub fn iterations(&self) -> usize

Number of coordinate sweeps over the current working set performed.

kkt_violation

pub fn kkt_violation(&self) -> f64

Maximum absolute KKT violation, as defined by crate::Lasso::tolerance.

objective

pub fn objective(&self) -> f64

Final primal objective P(beta_0, beta) = ||residual||² / (2n) + lambda * ||beta||₁.

predict

pub fn predict<M: RawColumns<f64> + ?Sized>(
    &self,
    x: &M
) -> Result<Vec<f64>, FitError>

Predict from raw columns in the same order as the training design.

Uses original-scale parameters, without estimating new centers or scales. Empty prediction batches return an empty vector.

Errors

Returns an error for a feature-count mismatch, nonfinite input, or nonfinite prediction arithmetic.

preprocessing

pub fn preprocessing(&self) -> &Preprocessing

Fitted training-column centers and scales.

reference_loss

pub fn reference_loss(&self) -> f64

Averaged loss at zero coefficients and the optimal enabled intercept.

stopping_criterion

pub fn stopping_criterion(&self) -> StoppingCriterion

Criterion selected for this fit.

stopping_threshold

pub fn stopping_threshold(&self) -> f64

Threshold applied to the selected criterion.

stopping_value

pub fn stopping_value(&self) -> f64

Final value of the selected criterion.

termination

pub fn termination(&self) -> Termination

Whether the fit converged or exhausted its iteration budget.

working_set_diagnostics

pub fn working_set_diagnostics(&self) -> &shrinkage::WorkingSetDiagnostics

Work performed by heuristic feature selection, separate from safe screening.

Implementation of Clone

impl Clone for LassoFit

clone

fn clone(&self) -> Self

Implementation of Debug

impl Debug for LassoFit

fmt

fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result

Implementation of ValidationFit

impl ValidationFit for shrinkage::LassoFit

predict

fn predict<M: RawColumns<f64> + ?Sized>(
    &self,
    design: &M
) -> Result<Vec<f64>, FitError>

termination

fn termination(&self) -> Termination

Implementation of Freeze

impl Freeze for LassoFit

Implementation of RefUnwindSafe

impl RefUnwindSafe for LassoFit

Implementation of Send

impl Send for LassoFit

Implementation of Sync

impl Sync for LassoFit

Implementation of Unpin

impl Unpin for LassoFit

Implementation of UnsafeUnpin

impl UnsafeUnpin for LassoFit

Implementation of UnwindSafe

impl UnwindSafe for LassoFit

Implementation of Any

impl<T> Any for T where T: 'static + ?Sized

Implementation of Borrow

impl<T> Borrow<T> for T where T: ?Sized

Implementation of BorrowMut

impl<T> BorrowMut<T> for T where T: ?Sized

Implementation of ByRef

impl<T> ByRef<T> for T

Implementation of CastableFrom

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT where ST: ?Sized, DT: ?Sized

Implementation of CastableFrom

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT where ST: ?Sized, DT: ?Sized

Implementation of CloneToUninit

impl<T> CloneToUninit for T where T: Clone

Implementation of From

impl<T> From<T> for T

Implementation of Imply

impl<T, U> Imply<T> for U where T: ?Sized, U: ?Sized

Implementation of Into

impl<T, U> Into<U> for T where U: From<T>

Implementation of IntoEither

impl<T> IntoEither for T

Implementation of Pointable

impl<T> Pointable for T

Implementation of Read

impl<T> Read<Exclusive, BecauseExclusive> for T where T: ?Sized

Implementation of Same

impl<T> Same for T

Implementation of SupersetOf

impl<SS, SP> SupersetOf<SS> for SP where SS: SubsetOf<SP>

Implementation of ToOwned

impl<T> ToOwned for T where T: Clone

Implementation of TryFrom

impl<T, U> TryFrom<U> for T where U: Into<T>

Implementation of TryInto

impl<T, U> TryInto<U> for T where U: TryFrom<T>