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
[1] D. Plečko and N. Meinshausen, “Fair Data Adaptation with Quantile Preservation,” Journal of Machine Learning Research, 2020. [2] D. Plečko and N. Bennett and N. Meinshausen, “FairAdapt: Causal Reasoning for Fair Data Pre-processing,” arXiv, 2021. Variables: 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_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: - X_train (pandas.DataFrame) – Training data frame (including the protected attribute).
- y_train (pandas.Series) – Training labels.
- X_test (pandas.DataFrame) – Test data frame (including the protected attribute).
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.