FeatureStructure#
- class superglm.FeatureStructure(
- kind: str,
- levels: list = <factory>,
- groups: dict = <factory>,
- reference: Any = None,
- unseen: str = 'error',
- ranges: list = <factory>,
- specials: list | None = None,
- knots: dict | None = None,
- basis: dict | None = None,
Bases:
objectThe structural decisions recorded for one feature.
- Parameters:
- kind{“categorical”, “ordered”, “spline”}
The kind of term: a
Categorical, anOrderedCategorical, or a numeric spline.- levelslist
The full level universe, in model order, in the levels’ native types (categorical and ordered terms).
- groupsdict[str, list]
Each group label and the levels it holds. Levels in no group stand alone.
- referenceobject
The reference: an ungrouped level or a group label, never a base policy, even when it is named “first” or “most_exposed”.
- unseenstr
Where levels unseen at fit go:
"error","base"or a group label. An ordered term refuses new levels, so its policy is"error".- rangeslist of PolynomialRange
The spline’s polynomial ranges in the feature’s own units, or between band names on an ordered term.
- specialslist or None
An ordered term’s special levels, fitted off its curve each with a free estimate of its own. None, as in a file that names none, keeps the specials the model declares.
- knotsdict or None
The knots of a spline, or of an ordered term’s spline basis, chosen in the editor:
n_knots,strategy("explicit"or a placement rule),knot_alphaandpositions, the interior knots the fit placed on the spline’s own axis. An explicit strategy states the positions; a rule placesn_knotsknots on the data the model is fit on. None, as in a file that names none, keeps the declared knots.- basisdict or None
The basis of a spline, or of an ordered term’s spline basis, chosen in the editor:
kind("ps","bs","cr","ns"or"cr_cardinal") andselect, whether the double penalty lets the fit shrink the term towards a straight line and to nothing. Applying it rebuilds the declared spline as that kind, keeping its other settings, before the knots and ranges. None, as in a file that names none, keeps the declared basis.