Skip to main content

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
End-to-end pipeline
CI/CD integration
Production monitoring
GitHub Action
REST API
DataFrame + Parquet I/O

PyPI version Python versions Coverage Launch in Binder


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

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.

SvrusIO/fairpipe-action


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.

Launch in Binder Open in Colab


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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fairpipe-0.9.0.tar.gz (96.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fairpipe-0.9.0-py3-none-any.whl (121.5 kB view details)

Uploaded Python 3

File details

Details for the file fairpipe-0.9.0.tar.gz.

File metadata

  • Download URL: fairpipe-0.9.0.tar.gz
  • Upload date:
  • Size: 96.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for fairpipe-0.9.0.tar.gz
Algorithm Hash digest
SHA256 322d0908e76db0f8a923180b0b2d04f891bb775fb288a6831e4882ff38fec72b
MD5 c8256e467d311cfd6b213ff8a235ff26
BLAKE2b-256 1fcaa0fd8f9510a71c82ebbe29d86182f16e24757249cd73f363147395331c98

See more details on using hashes here.

File details

Details for the file fairpipe-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: fairpipe-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 121.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for fairpipe-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b8c1e3fe58d736636dbb47d20d7baefcf5aa59a6d06d1605b94c60d17f31f53
MD5 17c96f67c657fd7ad1ba534bd34d2fd8
BLAKE2b-256 44570a2b7a7f5f2e71f9a1a15932de8bd583c571010818ca6003b377127944b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page