LevelGrouping#

class superglm.LevelGrouping(
original_to_group: dict[str, str],
group_to_originals: dict[str, list[str]],
all_original_levels: list[str],
grouped_levels: list[str],
)#

Bases: object

Mapping between original categorical levels and grouped levels.

Parameters:
original_to_groupdict[str, str]

Maps each original level to its group label. Identity-mapped levels map to themselves.

group_to_originalsdict[str, list[str]]

Inverse mapping: group label -> list of original levels in that group.

all_original_levelslist[str]

All original level names, in their original order.

grouped_levelslist[str]

The unique group labels, in order.