Shrinkage

shrinkage.LassoFit

Shrinkage for Python · python · 0.2.0

LassoFit(_native: shrinkage._shrinkage._LassoFit)

Owned lasso parameters, fitted preprocessing, and final diagnostics.

Check termination before treating a fit as converged. Properties are read-only, and returned arrays are independent copies. The result retains neither the training arrays nor their Rust snapshots.

coefficients

coefficients(self) -> FloatArray

Original-scale coefficients with shape (n_features,).

intercept

intercept(self) -> float

Original-scale intercept, including the correction for centering.

preprocessing

preprocessing(self) -> shrinkage.Preprocessing

Training transformations; prediction never estimates new ones.

termination

termination(self) -> shrinkage.Termination

"converged" or "iteration_limit" from the Rust solver.

iterations

iterations(self) -> int

Complete coordinate sweeps; initially optimal fits take zero.

objective

objective(self) -> float

Final average squared loss plus the optimization-scale L1 penalty.

kkt_violation

kkt_violation(self) -> float

Maximum KKT violation, including the free intercept derivative.

dual_certificate

dual_certificate(self) -> FloatArray

Feasible Gaussian dual vector theta with shape (n_samples,).

dual_objective

dual_objective(self) -> float

Dual objective D(theta) = y @ theta - n * ||theta||**2 / 2.

duality_gap

duality_gap(self) -> float

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

The nonnegative gap can be loose at zero penalty.

reference_loss

reference_loss(self) -> float

Fixed average loss at zero coefficients and the optimal free intercept.

stopping

stopping(self) -> shrinkage.StoppingCriterion

Resolved criterion, including the default selected for this penalty.

stopping_value

stopping_value(self) -> float

Final value of the selected convergence check on refreshed state.

stopping_threshold

stopping_threshold(self) -> float

Threshold applied to the selected convergence check.

predict

predict(x: object, *, copy: bool = True) -> FloatArray

Predict raw NumPy float64 rows, returning shape (n_samples,).

Use training-column order. The dense input contract also applies here, with empty batches allowed. Prediction copies inputs before releasing the GIL, uses original-scale parameters, and never refits preprocessing. Invalid shapes or values raise TypeError or ValueError; nonfinite prediction arithmetic raises FloatingPointError.