pgrg_ordered#

solas_disparity.pgrg_ordered(...)#

Create an ordered list of protected and reference groups.

Parameters
  • protected_groups (List[str]) – List of protected groups.

  • reference_groups (List[str]) – List of reference groups associated with each protected group.

  • group_categories (Optional[List[str]], optional) – Group categories associated with each protected group. If None, ordered group categories are returned alongside unique group names. Defaults to None.

Returns

List of ordered protected and reference groups. May also include group categories if group_categories is set.

Return type

List[str]

Examples

>>> protected_groups = ["black", "asian", "female", "hispanic"]
>>> reference_groups = ["white", "white", "male", "white"]
>>> pgrg_orderd(protected_groups, reference_groups)
["black", "asian", "hispanic", "white", "female", "male"]