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.
Interaction-only tensor product spline (ti) term. |
|
Varying-coefficient interaction: spline curve per categorical level. |
|
Varying-coefficient interaction: polynomial curve per categorical level. |
|
Varying-slope interaction: per-level numeric slope. |
|
Cross-product interaction between two categorical features. |
|
Product interaction between two numeric features. |
|
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.
A feature specification attached to a named input column. |
|
An interaction declaration for use inside a family 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.
A single shape constraint: when it is applied, and what it requires. |
|
Linear inequality constraints: A @ theta >= b. |
|
Constrained fitted-basis projection for monotone spline curves. |
|
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.
Continuous fitted curve for plotting (not for rating tables). |
|
Knot and basis metadata for a spline term. |