Spline#

superglm.Spline(
kind: Literal['cr', 'ps', 'bs', 'ns', 'cr_cardinal'] | None = None,
*,
k: int | None = None,
n_knots: int | None = None,
degree: int = 3,
knot_strategy: Literal['uniform', 'quantile', 'quantile_rows', 'quantile_tempered'] = 'uniform',
penalty: Literal['ssp', 'none'] | None = 'ssp',
select: bool = False,
knots: ArrayLike | None = None,
discrete: bool | None = None,
n_bins: int | None = None,
extrapolation: Literal['clip', 'extend', 'error'] = 'clip',
boundary: tuple[float, float] | None = None,
knot_alpha: float = 0.2,
constraint=None,
m: int | tuple[int, ...] = 2,
lambda_policy: LambdaPolicy | dict[str, LambdaPolicy] | None = None,
polynomial_ranges: Sequence[PolynomialRange] | None = None,
shape_engine: Literal['qp', 'scop'] = 'qp',
) → _SplineBase#

Create a spline feature spec.

With no kind the spline is a cubic regression spline, "cr" (a P-spline, "ps", before 0.40). "cr" and "cr_cardinal" are always cubic and refuse a degree other than 3; cr takes penalty orders m up to 3 and cr_cardinal only 2. Pass kind="ps" (or "bs" for another degree) beyond those. A spline with no kind that cr cannot serve (a degree other than 3 or a penalty order above 3) builds as "ps", as before 0.40, with a UserWarning; pass kind= to choose and silence it.

polynomial_ranges (kind="bs" or "cr" only) pins the curve to a polynomial on each PolynomialRange and leaves the rest the penalised smooth.

A fit-time shape constraint fits on the QP for every kind. shape_engine="scop" names the retired SCOP engine: it is accepted with a UserWarning and the constraint fits on the QP; see PSpline.