FairLib - Python Library for Fairness Metrics and Processing
This library provides a set of tools for measuring and improving fairness in machine learning models, covering a variety of fairness metrics, pre-processing, in-processing, and post-processing techniques.
Complete Workflow Example Notebook
Library functionality
The library will provide some fairness metrics to perform various analyses. Plus a number of pre-processing, in-processing and post-processing algorithms.
Fairness Metrics
- Statistical Parity Difference - Example Notebook
- Disparate Impact - Example Notebook
- Equal Opportunity Difference - Example Notebook
Pre-Processing Techniques
- Disparate Impact Remover - Example Notebook
- LFR (Learning Fair Representations) - Example Notebook
- Reweighing - Example Notebook
In-Processing Techniques
- FaUCI - Example Notebook
- Adversarial Debiasing - Example Notebook
- Prejudice Remover - Example Notebook
Project Structure
Overview of the project structure:
<root directory>
├── fairlib/ # Main package for the project
│ ├── __init__.py # Package marker
│ ├── metrics/ # Fairness metrics implementations
│ ├── preprocessing/ # Pre-processing techniques for fairness
│ └── inprocessing/ # In-processing debiasing algorithms
├── tests/ # Unit tests for the library
│ ├── metrics/ # Unit tests for fairness metrics
│ ├── preprocessing/ # Unit tests for pre-processing methods
│ └── inprocessing/ # Unit tests for in-processing techniques
├── examples/ # Jupyter notebooks with examples
├── .github/ # GitHub workflows for CI/CD
│ └── workflows/
│ ├── test.yml # Run tests on multiple Python versions
│ └── deploy.yml # Deploy to PyPI if tests succeed
├── pyproject.toml # Project configuration file managed by Poetry
├── LICENSE # License file (Apache 2.0 by default)
├── README.md # Project documentation (this file)
├── renovate.json # Configuration of Renovate bot, for automatic dependency updates
├── requirements.txt # Only declares a dependency on Poetry. DO NOT EDIT THIS FILE
└── release.config.js # Script to release on PyPi, and GitHub via semantic-release
Restore dev dependencies
- Install Poetry if you don't have it yet
pip install -r requirements.txt
- Install the project's dependencies
poetry install
Run unit tests
poetry run poe test
Tests are automatically run in CI, on all pushes on all branches. There, tests are executed on multiple OS (Win, Mac, Ubuntu) and on multiple Python versions.
Release files for aequitas-fairlib 2.8.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aequitas_fairlib-2.8.2.tar.gz | 29.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aequitas_fairlib-2.8.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 66.5 kB
Release files / aequitas_fairlib-2.8.2.tar.gz
| Download URL | aequitas_fairlib-2.8.2.tar.gz |
|---|---|
| Size | 29.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
26aa0f41825eeeba1a42de230029b05065fd5443b32bf280a06a31755a2f00e6
|
|
BLAKE2b-256 checksum How to use checksums |
042fdab01912780c792aea6def1c9ae965ba09446aa8af11507a0c9b3fc85e6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-1015-azure
|
Release files / aequitas_fairlib-2.8.2-py3-none-any.whl
| Download URL | aequitas_fairlib-2.8.2-py3-none-any.whl |
|---|---|
| Size | 37.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
46adc32adbf34935c9e1f36e69588ad6968cf8bb5df7c25b29552b5a81023d8b
|
|
BLAKE2b-256 checksum How to use checksums |
85439dd26956079901fa30e7482d2b31f1fc7719bd7caf784d063d49f5744d60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-1015-azure
|