aif360.sklearn.preprocessing.FairAdapt

class aif360.sklearn.preprocessing.FairAdapt(prot_attr, adj_mat)[source]

Fair Data Adaptation.

Fairadapt is a pre-processing technique that can be used for both fair classification and fair regression [1]. The method is a causal inference approach to bias removal and it relies on the causal graph for the dataset. The original implementation is in R [2].

References

Variables:
  • prot_attr_ (str or list(str)) – Protected attribute(s) used for fair data adaptation.

  • groups_ (array, shape (n_groups,)) – A list of group labels known to the transformer.

Parameters:
  • prot_attr (single label) – Name of the protected attribute. Must be binary.

  • adj_mat (array-like) – A 2-dimensional array representing the adjacency matrix of the causal diagram of the data generating process. Row/column order must match X_train.

Methods

fit_transform

Remove bias from the given dataset by fair adaptation.

get_metadata_routing

Get metadata routing of this object.

get_params

Get parameters for this estimator.

set_params

Set the parameters of this estimator.

__init__(prot_attr, adj_mat)[source]
Parameters:
  • prot_attr (single label) – Name of the protected attribute. Must be binary.

  • adj_mat (array-like) – A 2-dimensional array representing the adjacency matrix of the causal diagram of the data generating process. Row/column order must match X_train.

fit_transform(X_train, y_train, X_test)[source]

Remove bias from the given dataset by fair adaptation.

Parameters:
Returns:

tuple – Transformed inputs.

  • X_fair_train (pandas.DataFrame) – Transformed training data.

  • y_fair_train (array-like) – Transformed training labels.

  • X_fair_test (pandas.DataFrame) – Transformed test data.