cat#
- superglm.cat(
- column: Hashable,
- *,
- base: Literal['most_exposed', 'first'] | str = 'most_exposed',
- grouping: LevelGrouping | None = None,
- levels: Any = None,
- unseen: Literal['error', 'base'] | str = 'error',
- constraint: ConstraintSpec | ConstraintRules | None = None,
Declare a categorical effect with a reference level.
Use
cat("region")for categories, including categories stored as numbers. A bare string in a predictor always declares a numeric linear term and does not infer categorical encoding from the column’s dtype.- Parameters:
- columnhashable
Label of the categorical input column, usually its name.
- base{“most_exposed”, “first”} or str, default=”most_exposed”
Reference level. Use the level with the greatest total sample weight,
"first"for the first level, or a specific level name.- groupingLevelGrouping, optional
Combine input levels into groups before encoding.
- levelssequence, data column or categorical dtype, optional
Declare the allowed input levels. With
grouping, these are the original levels before grouping.- unseen{“error”, “base”} or str, default=”error”
Prediction policy for levels outside the fitted level universe.
"base"uses the reference level and emits a warning. The label of a group ofgroupinggives them that group’s effect, also with a warning.- constraintConstraintSpec or ConstraintRules, optional
Relativity cap, e.g.
Constraint.fit.cap(0.7, 1.5); caps only — use an ordered term for shapes.
- Returns:
- BoundTerm
A categorical declaration for the named column.
See also
CategoricalEncoding, grouping and level-universe rules.
reA penalized effect with a coefficient for every level.