Skip to content

Interactions

Interactions between features are specified via the interactions parameter. The interaction type is auto-detected from the parent feature specs.

model = SuperGLM(
    features={"age": Spline(k=14), "region": Categorical()},
    interactions=[("age", "region")],
    selection_penalty=0.01,
)
model.fit(df, y, sample_weight=exposure)

Auto-detected interaction types

Parent types Interaction class Groups
Spline + Categorical SplineCategorical One spline group per non-base level
Polynomial + Categorical PolynomialCategorical One polynomial group per non-base level
Numeric + Categorical NumericCategorical Single group with per-level slopes
Categorical + Categorical CategoricalInteraction Single group with cross-level indicators
Numeric + Numeric NumericInteraction Single group (product term)
Polynomial + Polynomial PolynomialInteraction Single group (tensor product)