PolynomialInteraction#
- class superglm.PolynomialInteraction(poly1_name: str, poly2_name: str)#
Bases:
objectCross-product of two polynomial bases.
Single group of
n1 * n2columns formed by all pairwise products of the two parents’ orthonormal components (constant excluded). Both margins evaluate through the parents’ stored factors (deep copies of the fitted parent specs) — never re-orthogonalized.Note the parents’ weight-orthonormality does not transfer to this block: pairwise products of two weight-orthonormal margins are not weight-orthonormal unless the margins are independent under the weights, so the standardized-group-lasso argument is a main-effect property and does not extend to the product columns.
- reconstruct(
- beta: NDArray,
- n_points: int = 50,
Evaluate the surface on a grid without materialising a cross design.
The cross design over a meshgrid is
(n_points**2, n1*n2), so it grows with the SQUARE of the requested resolution while carrying no information the two marginal bases do not: the product structure meansf(x1_i, x2_j) = P1[i] C P2[j], which factors. Atn_points=250with two degree-50 parents the dense form is about 1.25 GB against 4.8 MB for the fit’s own design – and the rating-table impact sweep reconstructs at every rung of its ladder, so a model that exported before could run out of memory once interactions joined the sweep.Same value and same convention as before –
surface[j, i] = f(x1[i], x2[j]), which is whatnp.meshgrid’s default"xy"indexing produced – reached by the associationTensorInteractionalready uses.