aif360.algorithms.postprocessing.DeterministicReranking

class aif360.algorithms.postprocessing.DeterministicReranking(unprivileged_groups, privileged_groups)[source]

A collection of algorithms for construction of fair ranked candidate lists. [1] .

References

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

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

Methods

fit

Train a model on the input.

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

Construct a ranking of candidates in the dataset according to specified proportions of groups.

transform

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

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

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

fit(dataset: RegressionDataset)[source]

Train a model on the input.

Parameters:

dataset (Dataset) – Input dataset.

Returns:

Transformer – Returns self.

fit_predict(dataset: RegressionDataset, rec_size: int, target_prop: dict, rerank_type: str = 'Constrained', renormalize_scores: bool = False) RegressionDataset[source]

Train a model on the input and predict the labels.

Equivalent to calling fit(dataset) followed by predict(dataset).

Parameters:

dataset (Dataset) – Input dataset.

Returns:

Dataset – Output dataset. metadata should reflect the details of this transformation.

predict(dataset: RegressionDataset, rec_size: int, target_prop: list, rerank_type: str = 'Constrained', renormalize_scores: bool = False) RegressionDataset[source]

Construct a ranking of candidates in the dataset according to specified proportions of groups.

Parameters:
  • dataset (RegressionDataset) – Dataset to rerank.

  • rec_size (int) – Number of candidates in the output.

  • target_prop (list) – Desired proportion of each group in the output.

  • rerank_type – Greedy, Conservative, Relaxed, or Constrained. Determines the type of algorithm as described in the original paper.

  • renormalize_scores – renormalize label (score) values in the resulting ranking. If True, uses the default behavior of RegressionDataset.

Returns:

RegressionDataset – The reranked dataset.