aif360.algorithms.preprocessing.Reweighing

class aif360.algorithms.preprocessing.Reweighing(unprivileged_groups, privileged_groups)[source]

Reweighing is a preprocessing technique that Weights the examples in each (group, label) combination differently to ensure fairness before classification [4].

References

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

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

Methods

fit

Compute the weights for reweighing the dataset.

fit_predict

Train a model on the input and predict the labels.

fit_transform

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

predict

Return a new dataset with labels predicted by running this Transformer on the input.

transform

Transform the dataset to a new dataset based on the estimated transformation.

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

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

fit(dataset)[source]

Compute the weights for reweighing the dataset.

Parameters:

dataset (BinaryLabelDataset) – Dataset containing true labels.

Returns:

Reweighing – Returns self.

transform(dataset)[source]

Transform the dataset to a new dataset based on the estimated transformation.

Parameters:

dataset (BinaryLabelDataset) – Dataset that needs to be transformed.

Returns:

dataset (BinaryLabelDataset)

Dataset with transformed

instance_weights attribute.