aif360.algorithms.inprocessing.MetaFairClassifier

class aif360.algorithms.inprocessing.MetaFairClassifier(tau=0.8, sensitive_attr='', type='fdr')[source]

The meta algorithm here takes the fairness metric as part of the input and returns a classifier optimized w.r.t. that fairness metric [11].

References

[11]L. E. Celis, L. Huang, V. Keswani, and N. K. Vishnoi. “Classification with Fairness Constraints: A Meta-Algorithm with Provable Guarantees,” 2018.
Parameters:
  • tau (double, optional) – Fairness penalty parameter.
  • sensitive_attr (str, optional) – Name of protected attribute.
  • type (str, optional) – The type of fairness metric to be used. Currently “fdr” (false discovery rate ratio) and “sr” (statistical rate/disparate impact) are supported. To use another type, the corresponding optimization class has to be implemented.

Methods

fit Learns the fair classifier.
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 Obtain the predictions for the provided dataset using the learned classifier model.
transform Return a new dataset generated by running this Transformer on the input.
__init__(tau=0.8, sensitive_attr='', type='fdr')[source]
Parameters:
  • tau (double, optional) – Fairness penalty parameter.
  • sensitive_attr (str, optional) – Name of protected attribute.
  • type (str, optional) – The type of fairness metric to be used. Currently “fdr” (false discovery rate ratio) and “sr” (statistical rate/disparate impact) are supported. To use another type, the corresponding optimization class has to be implemented.
fit(dataset)[source]

Learns the fair classifier.

Parameters:dataset (BinaryLabelDataset) – Dataset containing true labels.
Returns:MetaFairClassifier – Returns self.
predict(dataset)[source]

Obtain the predictions for the provided dataset using the learned classifier model.

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