Skip to content

yakew7/Fair-Code

v2.0.0 Feature

This release adds 2 notable features for engineering teams evaluating rollout.

Published 3d AI Coding Tools
โœ“ No known CVEs patched
Read the diff โ†’ Tool health โ†’ What is this tool? โ†’

✓ No known CVEs patched in this version

Topics

ai-fairness algorithmic-bias bias-detection bias-mitigation criminal-justice fairness
+9 more
healthcare hiring jupyter lending machine-learning python responsible-ai scikit-learn welfare

Summary

AI summary

Updates ๐ŸŽฏ Cross-Domain Benchmark Harness, โœ… Tests & CI, and ๐Ÿ› Fixed across a mixed release.

Full changelog

Fair Code v2.0.0 โ€” Cross-Domain Fairness Benchmark Harness

Fair Code moves from seven bespoke bias audits to a benchmark harness that runs one uniform, reproducible pipeline over all of them โ€” the core of what a research paper built on this repo would cite. Nothing about the existing audits (unfair.py / fair.py, the website, the explainers) changed or broke; this release is additive.

๐ŸŽฏ Cross-Domain Benchmark Harness

  • audit.yaml manifests โ€” every audit folder now carries a declarative manifest naming its label column, protected attributes, proxy features, and core (fair) feature set. Schema: faircode/MANIFEST_SPEC.md.
  • Five mitigation strategies (S0โ€“S4), run uniformly across all seven domains:
    • baseline โ†’ unawareness โ†’ unawareness_proxy_removal (the existing fair.py method) โ†’ in_processing (Fairlearn ExponentiatedGradient) โ†’ post_processing (Fairlearn ThresholdOptimizer)
  • Three model families (logistic regression, random forest, gradient boosting) ร— six fairness metrics (demographic parity, disparate impact ratio, equal opportunity, equalized odds, predictive parity, accuracy equality) โ€” each with a bootstrap CI and permutation-test p-value โ€” plus accuracy/AUC/F1 and intersectional gaps.
  • New CLI: faircode benchmark (optional faircode[benchmark] extra). Writes results_fairness.csv, results_performance.csv, summary.csv, and 300-dpi figures to results/.

๐Ÿ” Reproducibility & Paper Freeze

  • All randomness pinned to random_state: 42 across every model, split, bootstrap, and permutation โ€” verified, not assumed.
  • requirements-lock.txt โ€” exact environment (Python 3.13.2, scikit-learn 1.8.0, fairlearn 0.14.0, pandas 3.0.2).
  • scripts/freeze_paper_results.py โ€” snapshots results/ into paper/results-frozen/ with a MANIFEST.md recording the git commit, package versions, and the exact set of audits included, so a citation points at a defined, reproducible snapshot instead of "whatever was in the repo that week."

โœ… Tests & CI

  • 50 new tests (108 total, ~10s) covering all six fairness metrics against hand-computed examples, manifest validation, S0โ€“S4 strategy correctness, and a genuine end-to-end harness run.
  • New benchmark-harness CI job runs the suite plus a real CLI smoke test on one small audit. The full seven-domain sweep stays out of CI by design โ€” it's run locally and the output committed.

๐Ÿ› Fixed

  • ThresholdOptimizer (S4) was calibrating decision thresholds on the same rows its base model was trained on, producing a near-zero gap in-sample but +0.22 out-of-sample on German Credit Lending. Fixed with a proper fit/calibration split โ€” residual gap now a defensible +0.07.
  • All 14 fair.png / unfair.png screenshots regenerated from fresh runs โ€” the old images predated the bootstrap CI / permutation-test output and only showed the bare headline gap. Every underlying number was independently re-verified against the live site (all matched exactly).

๐Ÿ“ˆ The headline result (COMPAS)

Demographic parity gap across the five strategies: 86% โ†’ 18% โ†’ 12% โ†’ 1.4% โ†’ 2.4%. The two Fairlearn-based strategies land within a couple points of simple proxy removal โ€” evidence for a residual fairness floor, not a limitation of any one method.

Full changelog: CHANGELOG.md ยง 2.0.0

Weekly OSS security release digest.

The CVE patches and breaking changes that affected production tools this week. One email, every Sunday.

No spam, unsubscribe anytime.

Share this release

Track yakew7/Fair-Code

Get notified when new releases ship.

Sign up free

About yakew7/Fair-Code

All releases โ†’

Beta — feedback welcome: [email protected]