Features#

Feature specifications turn raw columns into model terms. Spline is the public factory for smooth terms; the concrete spline classes are what it returns. Categorical, ordered-categorical, numeric, polynomial and piecewise terms cover the rest of a rating structure; FactorSmooth and RandomEffect add credibility-style shrinkage; Constraint requests monotone or curvature constraints. The interaction types the constructor builds from a pair of columns are on the Internals page.

superglm.Spline

Create a spline feature spec.

superglm.PSpline

P-spline: B-spline basis with a discrete-difference penalty.

superglm.BSplineSmooth

B-spline smooth: B-spline basis with an integrated-derivative penalty.

superglm.NaturalSpline

Natural P-spline: f''=0 at boundaries, linear tails.

superglm.CubicRegressionSpline

CR spline: integrated f'' squared penalty + natural boundary constraints.

superglm.PolynomialRange

Pin a spline to a polynomial of degree (0-3) on [lo, hi].

superglm.n_knots_from_k

Convert basis dimension k to interior knot count.

superglm.Categorical

One-hot encoded categorical feature.

superglm.OrderedCategorical

Ordered categorical feature smoothed by a spline over its level values.

superglm.Numeric

A single continuous feature used as-is.

superglm.Piecewise

Continuous piecewise-linear feature on stated breakpoints.

superglm.Polynomial

Orthogonal polynomial feature (orthonormal in the training-weight measure).

superglm.FactorSmooth

A factor-by-P-spline interaction.

superglm.RandomEffect

All-level categorical effect with a REML-estimated variance component.

superglm.LevelGrouping

Mapping between original categorical levels and grouped levels.

superglm.collapse_levels

Build a LevelGrouping from data and grouping rules.

superglm.Constraint

The shape constraints a feature can carry, reached through Constraint.