Internals#

Objects the library builds on your behalf. You rarely write them, but they appear in signatures, inside the records a fit returns, and in tracebacks, so each has a page. None is needed to fit, read or deploy a model the documented way; a few carry options you reach for only when the default construction is not enough.

Interaction types#

Pass a pair of column names as interactions=[("age", "region")] and the constructor picks one of these from the two parent feature specifications; pass one explicitly only when you need its options. The how-to on interactions says which pair produces which type.

superglm.TensorInteraction

Interaction-only tensor product spline (ti) term.

superglm.SplineCategorical

Varying-coefficient interaction: spline curve per categorical level.

superglm.PolynomialCategorical

Varying-coefficient interaction: polynomial curve per categorical level.

superglm.NumericCategorical

Varying-slope interaction: per-level numeric slope.

superglm.CategoricalInteraction

Cross-product interaction between two categorical features.

superglm.NumericInteraction

Product interaction between two numeric features.

superglm.PolynomialInteraction

Cross-product of two polynomial bases.

SuperLSS predictor plumbing#

The declaration helpers return a BoundTerm or BoundInteraction, a feature specification attached to a named column; a family’s helper method wraps them in a BoundPredictor, listed with the declarations, and Predictor is the immutable configuration SuperLSS reads underneath.

superglm.BoundTerm

A feature specification attached to a named input column.

superglm.BoundInteraction

An interaction declaration for use inside a family predictor.

superglm.Predictor

Immutable configuration for one natural-parameter predictor.

Constraint machinery#

Constraint is what you write, and Constraint.fit.increasing and its siblings are ConstraintSpec values: one shape constraint, with when it applies and what it requires. Where a fit-time constraint is enforced by quadratic programming it is expressed as the linear inequalities of a LinearConstraintSet. Behind apply_shape_postfit(), monotone constraints are repaired by a MonotoneRepairer and curvature constraints by a repairer of their own that is not exported; both record what they did in a MonotoneRepairResult.

superglm.ConstraintSpec

A single shape constraint: when it is applied, and what it requires.

superglm.LinearConstraintSet

Linear inequality constraints: A @ theta >= b.

superglm.MonotoneRepairer

Constrained fitted-basis projection for monotone spline curves.

superglm.MonotoneRepairResult

Result of a post-fit shape repair for one spline feature.

Parts of a term inference#

TermInference, which term_inference() returns for a main effect, can carry these two, depending on the term: the continuous fitted curve for plotting, and the knot and basis metadata of a spline term. For an interaction the method returns an InteractionInference instead, listed with the other inference results.

superglm.SmoothCurve

Continuous fitted curve for plotting (not for rating tables).

superglm.SplineMetadata

Knot and basis metadata for a spline term.