aif360.algorithms.postprocessing.EqOddsPostprocessing

class aif360.algorithms.postprocessing.EqOddsPostprocessing(unprivileged_groups, privileged_groups, seed=None)[source]

Equalized odds postprocessing is a post-processing technique that solves a linear program to find probabilities with which to change output labels to optimize equalized odds [8] [9].

References

Parameters:
  • unprivileged_groups (list(dict)) – Representation for unprivileged group.

  • privileged_groups (list(dict)) – Representation for privileged group.

  • seed (int, optional) – Seed to make predict repeatable.

Methods

fit

Compute parameters for equalizing odds using true and predicted labels.

fit_predict

fit and predict methods sequentially.

fit_transform

Train a model on the input and transform the dataset accordingly.

predict

Perturb the predicted labels to obtain new labels that satisfy equalized odds constraints.

transform

Return a new dataset generated by running this Transformer on the input.

__init__(unprivileged_groups, privileged_groups, seed=None)[source]
Parameters:
  • unprivileged_groups (list(dict)) – Representation for unprivileged group.

  • privileged_groups (list(dict)) – Representation for privileged group.

  • seed (int, optional) – Seed to make predict repeatable.

fit(dataset_true, dataset_pred)[source]

Compute parameters for equalizing odds using true and predicted labels.

Parameters:
Returns:

EqOddsPostprocessing – Returns self.

fit_predict(dataset_true, dataset_pred)[source]

fit and predict methods sequentially.

predict(dataset)[source]

Perturb the predicted labels to obtain new labels that satisfy equalized odds constraints.

Parameters:
  • dataset (BinaryLabelDataset) – Dataset containing labels that needs to be transformed.

  • dataset – Transformed dataset.