Shrinkage

shrinkage.PathFit

Shrinkage for Python · python · 0.2.0

Bases: typing.Generic[shrinkage.path.FitT]

PathFit(
    _native: shrinkage._shrinkage._ModelPath,
    _wrap: collections.abc.Callable[[_shrinkage._ModelFit], shrinkage.path.FitT]
)

Owned path in fitting order, with a complete result at every point.

fits[i] exposes every single-fit diagnostic and prediction method. penalties[i] retains both fusion strengths and all edge or rank weights. Finite iteration-limit points remain in the path and warm-start the next point. A fitting error raises without returning a partial path. Results retain no training arrays. Returned arrays are independent copies.

family

family(self) -> Family

Gaussian means or binomial logits, consistent across all points.

solver

solver(self) -> typing.Literal["hybrid", "proximal_gradient"]

Explicit numerical method used for every point, including empty paths.

n_features

n_features(self) -> int

Training column count, retained even for an empty path.

fits

fits(self) -> tuple[shrinkage.path.FitT, ...]

Per-point owned fits, aligned with penalties and parameter rows.

penalties

penalties(self) -> tuple[ClusteredLasso | ChainFusedLasso | Slope, ...]

Complete immutable penalty settings for each fitted point.

coefficients

coefficients(self) -> FloatArray

Original-scale float64 coefficients, shape (n_points, n_features).

intercepts

intercepts(self) -> FloatArray

Original-scale float64 intercepts, shape (n_points,).

lambdas

lambdas(self) -> FloatArray | None

Automatic scalar multipliers, shape (n_points,); explicit: None.

maximum_penalty

maximum_penalty(self) -> float | None

True zero threshold: finite or inf for automatic paths; else None.

lambda_start

lambda_start(self) -> float | None

Used automatic anchor, including an override; explicit paths: None.

termination

termination(self) -> shrinkage.PathTermination

Path completion or early stopping, independent of point convergence.

null_deviance

null_deviance(self) -> float | None

Averaged automatic-path null-model deviance; explicit paths: None.

deviances

deviances(self) -> FloatArray | None

Automatic fitted deviances, shape (n_points,); explicit: None.

predict

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

Predict float64 means or logits, shape (n_samples, n_points).

Columns follow path order, including duplicates. Empty batches and empty paths retain both axes. The dense input and copying rules match single fits. Inputs are copied once before Rust releases the GIL, and must remain unchanged until return. Prediction never refits transforms.