Production-ready toolkit for fairness measurement, mitigation, and monitoring.
Project description
fairpipe
Fairness measurement, mitigation, monitoring, and pipeline tooling for ML workflows.
PyPI package: fairpipe · License: Apache-2.0 · Python 3.10+
| Fairlearn | AIF360 | fairpipe | |
|---|---|---|---|
| Metrics library | ✅ | ✅ | ✅ |
| Mitigation algorithms | ✅ | ✅ | ✅ |
| DataFrame I/O | ✅ | ✅ | ✅ |
| Parquet I/O | ❌ | ❌ | ✅ |
| Orchestrated end-to-end pipeline | ⚠️ Partial | ⚠️ Partial | ✅ |
| CI/CD integration | ❌ | ❌ | ✅ |
| GitHub Action | ❌ | ❌ | ✅ |
| Production monitoring | ❌ | ❌ | ✅ |
| REST API | ❌ | ❌ | ✅ |
Fairlearn and AIF360 provide individual pre/in/post-processing components; fairpipe provides a YAML-configured baseline→transform→validate workflow with CI/CD exit codes.
Install
pip install fairpipe
Optional extras: pip install 'fairpipe[api]' · 'fairpipe[training]' · 'fairpipe[monitoring]' · 'fairpipe[adapters]'
(REST API, PyTorch training helpers, dashboards/drift, Fairlearn/Aequitas backends.) Full detail is in the documentation below—not duplicated here.
Documentation
Start here (hosted): Documentation — SvrusIO.github.io/fAIr
Built from this repo’s Sphinx sources; includes getting started, user guide, API reference, integration, performance, and security links.
In-repo references (for browsing on GitHub or a checkout):
| Topic | Location |
|---|---|
| Getting started | docs/getting_started.md |
| User guide (long-form) | DOCS.md |
| API reference | docs/api.md |
| Playbook · fairpipe (as implemented) | docs/playbook-part-five-fairpipe.md |
| Integration guide | docs/integration_guide.md |
| Architecture / ADR | docs/ADR-001-architecture.md |
| Versioning | docs/VERSIONING.md |
| Release checklist (mirror / PyPI) | docs/RELEASE.md |
| Changelog | CHANGELOG.md |
Quick start
CLI
fairpipe validate \
--csv data.csv \
--y-true y_true \
--y-pred y_pred \
--sensitive gender \
--with-ci
fairpipe run-pipeline --config config.yml --csv data.csv --output-dir artifacts/
Python
from fairpipe import load_data
from fairpipe.metrics import FairnessAnalyzer
df = load_data("data.csv")
analyzer = FairnessAnalyzer(min_group_size=30)
result = analyzer.demographic_parity_difference(
y_pred=df["y_pred"],
sensitive=df["gender"],
with_ci=True,
)
print(result.value, result.ci)
CLI commands, YAML configuration, workflow orchestration, training, monitoring, and the optional REST API are documented on the docs site and in docs/api.md.
CI/CD Integration
Add fairness validation to every pull request with the companion GitHub Action:
# .github/workflows/fairness-check.yml
name: Fairness Check
on: [pull_request]
jobs:
fairness:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: SvrusIO/fairpipe-action@v1
with:
csv: data/predictions.csv
y-true: y_true
y-pred: y_pred
sensitive: gender
threshold: "0.05"
metric: "equalized_odds_difference"
fail-on-violation: "true"
Point csv at your predictions file. If equalized odds difference exceeds 0.05, the PR is blocked. A full fairness report is written to the Actions job summary — metric values, confidence intervals, group breakdowns — permanently attached to the commit.
Development
git clone https://github.com/SvrusIO/fAIr.git
cd fAIr
pip install -e ".[dev]"
pytest -q
See CONTRIBUTING.md and SECURITY.md.
Case Studies
COMPAS Recidivism Bias Analysis — Reproduces ProPublica's 2016 Machine Bias finding. Measures an Equalized Odds Difference of 0.2116 on the COMPAS dataset and demonstrates a 53.9% reduction via Instance Reweighting.
Project links
| Homepage / docs | SvrusIO.github.io/fAIr |
| Repository | github.com/SvrusIO/fAIr |
| Issues | github.com/SvrusIO/fAIr/issues |
License
Apache License 2.0 — see LICENSE.
Project details
Release history Release notifications | RSS feed
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 fairpipe-0.9.1.tar.gz.
File metadata
- Download URL: fairpipe-0.9.1.tar.gz
- Upload date:
- Size: 97.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffac70ddead40a0758ef7630c76f501a89f5cc79b56bb4911bcaf131bb8a243c
|
|
| MD5 |
b89b4973c1b6024b519d992ebbefc848
|
|
| BLAKE2b-256 |
5023e2d599ea65691ec537ad6c5c28ebd742dd4ad4b664fde09319602b41976d
|
File details
Details for the file fairpipe-0.9.1-py3-none-any.whl.
File metadata
- Download URL: fairpipe-0.9.1-py3-none-any.whl
- Upload date:
- Size: 122.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f41badf9f2fecbabdccabcfdd87766197ed335ec108862eed57e1055cae33326
|
|
| MD5 |
795a69a13a8395bc167059e57c1a30ec
|
|
| BLAKE2b-256 |
d8ac8f85c4d5f344bc9e795ca8c2ac710e94a0ad169ff45b231c634735a7fd84
|