bind_levels#

SuperGLM.bind_levels(
X: object,
sample_weight: NDArray | None = None,
) → SuperGLM#

Bind categorical level universes from the outermost frame.

Runs the same pre-pass cross_validate applies to its own input: for every categorical-family feature, resolve the level universe and any unresolved most_exposed base from X, and store the result on this model’s configuration. Call it with the FULL frame before any train/val/test carve; every subsequent fit on any slice then shares one universe, and a level living only in the holdout is a pinned known level rather than a predict-time error.

Explicit levels= on a term always wins, and a frame value outside such a declared universe fails here rather than at fit. Re-calling replaces the stored bindings. Returns self so construction chains: model = SuperGLM(...).bind_levels(df).