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:
Methods
Train a model on the input.
Train a model on the input and predict the labels.
fit_transform
Train a model on the input and transform the dataset accordingly.
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.
- 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 bypredict(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.