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',
Create a spline feature spec.
With no
kindthe spline is a cubic regression spline,"cr"(a P-spline,"ps", before 0.40)."cr"and"cr_cardinal"are always cubic and refuse adegreeother than 3;crtakes penalty ordersmup to 3 andcr_cardinalonly 2. Passkind="ps"(or"bs"for another degree) beyond those. A spline with no kind thatcrcannot serve (adegreeother than 3 or a penalty order above 3) builds as"ps", as before 0.40, with aUserWarning; passkind=to choose and silence it.polynomial_ranges(kind="bs"or"cr"only) pins the curve to a polynomial on eachPolynomialRangeand 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 aUserWarningand the constraint fits on the QP; seePSpline.