shrinkage.Lasso
Shrinkage for Python · python · 0.2.0
Configure Gaussian lasso, then call fit for an owned result.
Minimize P(beta_0, beta) = F(beta_0, beta) + R(beta), where F = ||y - X_tilde @ beta - beta_0||**2 / (2*n) and R = lambda_ * ||beta||_1. The intercept is unpenalized. lambda_ must be finite and nonnegative. normalization="auto" divides columns by population standard deviations and centers by their means when fit_intercept=True. Other presets are independent of the intercept setting. Penalties act on normalized coefficients; results and predictions use the original input scale.
By default, positive penalties use relative duality gap 1e-6 and zero penalty uses absolute KKT violation 1e-6. stopping overrides this choice. max_iterations limits complete sweeps over the current working set and must be positive. Full convergence checks run at initialization, every ten sweeps, and at the iteration limit. Options are validated when fitting.
lambda_
Source: packages/python/src/shrinkage/lasso.py
: fit_intercept
Source: packages/python/src/shrinkage/lasso.py
: = normalization
Source: packages/python/src/shrinkage/lasso.py
: = stopping
Source: packages/python/src/shrinkage/lasso.py
: | None = max_iterations
Source: packages/python/src/shrinkage/lasso.py
: = fit
Source: packages/python/src/shrinkage/lasso.py
-> Fit exact NumPy float64 arrays of shapes (n, p) and (n,).
Strided, writable, and read-only arrays are supported. Both inputs are copied into Rust-owned storage with the GIL held. Callers must prevent concurrent mutation or resizing until copying finishes. Numerical fitting releases the GIL and calls no Python callbacks. copy=False raises ValueError.
Invalid data or options raise TypeError or ValueError. Nonfinite arithmetic from finite inputs raises FloatingPointError. An exhausted budget returns a fit with termination "iteration_limit".
