FairLib Documentation
Fairlib is a Python library designed to integrate fairness-aware machine learning methods, with the goal of reducing bias in predictive models.
Preprocessing Techniques
Preprocessing techniques modify the training data before model training to reduce bias:
- Disparate Impact Remover: Transforms feature distributions to a common median distribution across sensitive attribute groups to reduce disparate impact.
- Learning Fair Representations (LFR): Uses an encoder-decoder architecture to learn a fair representation of the data that preserves predictive information while removing sensitive attribute information.
- Reweighing: Assigns weights to training instances to ensure statistical independence between protected attributes and outcomes.
In-processing Techniques
In-processing techniques modify the learning algorithm to incorporate fairness constraints:
- Adversarial Debiasing: Uses adversarial learning to remove information about protected attributes from the model’s internal representations.
- FaUCI (Fairness Under Constrained Injection): Incorporates fairness metrics directly into the loss function as regularization terms.
- Prejudice Remover: Mitigates discrimination by adding a regularization term that penalizes mutual information between predictions and sensitive attributes.
Fairness Metrics
FairLib provides several metrics to evaluate and quantify bias in machine learning models:
- Statistical Parity Difference: Measures the difference in the probability of a favorable outcome between privileged and unprivileged groups.
- Disparate Impact: Measures the ratio of favorable outcome probabilities between unprivileged and privileged groups.
- Equality of Opportunity: Measures the difference in true positive rates between privileged and unprivileged groups.
For detailed information about these metrics, including interpretation and typical value ranges, see the Metrics documentation.
Additional Resources
For practical examples of using these algorithms and metrics, refer to the Jupyter notebooks in the examples/
directory of the FairLib package.