A library for detecting and mitigating bias in machine learning models, with a focus on interoperability with scikit-learn, Pandas, and PyTorch.
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aequitas_fairlib-2.8.1.tar.gz.
File metadata
- Download URL: aequitas_fairlib-2.8.1.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-1015-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1744da6051894c0b4f7a89d669ce3c8ef3b9118f430b97fc25a6780aaa7dd6e6
|
|
| MD5 |
728df58f7bb3c56a0b2aac7f7be402a3
|
|
| BLAKE2b-256 |
8ca478c4b6f26846de9e5bd0ec473419edf0298b117597c148dbcda1728cda45
|
File details
Details for the file aequitas_fairlib-2.8.1-py3-none-any.whl.
File metadata
- Download URL: aequitas_fairlib-2.8.1-py3-none-any.whl
- Upload date:
- Size: 37.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-1015-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed32984daf5a1729470fe31a3f823194f4f08c148f78d26b5e226416b36c9f4f
|
|
| MD5 |
90e1d81d01e3db17ab6a9ef1bc893b45
|
|
| BLAKE2b-256 |
ed5470e4d24bcca56da7b93b51aa851f30baf23ff1f9c8493cd90db189dee84a
|