Skip to main content

Fairness for AI, made simple. Audit, measure, and mitigate demographic bias in ML models.

Project description

🔍 FairCheck

Fairness for AI, made simple.

Tests License: MIT Python 3.8+ Code style: black Status: Alpha GitHub stars

Audit, measure, and mitigate demographic bias in your AI models with one line of code.


What is FairCheck?

FairCheck is an open-source Python library that makes fairness analysis in machine learning simple, accessible, and actionable. Whether you're a researcher, ML engineer, or AI ethics practitioner, FairCheck helps you understand how your models perform across demographic groups.

Why FairCheck?

Modern AI systems often exhibit demographic biases that are invisible in aggregate metrics. A model with 95% accuracy might perform dramatically worse for certain groups. FairCheck makes detecting and mitigating these biases as easy as one function call.

from faircheck import audit

results = audit(
    model=your_model,
    dataset=your_data,
    sensitive_attrs=['gender', 'race', 'age']
)

results.report()  # Beautiful interactive dashboard

That's it. No more 100-line scripts. No more custom analysis pipelines.

Key Features

  • One-line auditing - Comprehensive fairness analysis in a single function call
  • Multiple metrics - Demographic parity, equalized odds, TPR/FPR disparity, calibration, and more
  • Framework agnostic - Works with PyTorch, TensorFlow, Scikit-learn, and Hugging Face models
  • Beautiful reports - Interactive HTML dashboards, PDF exports, and JSON outputs
  • Bias mitigation - State-of-the-art techniques to reduce bias in trained models
  • Continuous monitoring - Track fairness in production over time
  • Research-grade - Implements peer-reviewed methods from leading fairness research

Installation

Note: FairCheck is currently in active development. The PyPI release is coming soon!

# Coming soon
pip install faircheck

# Development version
git clone https://github.com/kasra-kakavand/faircheck.git
cd faircheck
pip install -e .

Quick Start

Basic Audit

import faircheck as fc

# Audit any classifier in one line
results = fc.audit(
    model=my_model,
    dataset=test_data,
    sensitive_attrs=['gender']
)

# View results
print(results.summary())

# Generate detailed report
results.report(output='fairness_report.html')

Bias Mitigation

from faircheck import mitigate

# Apply variance-based fairness regularization
fair_model = mitigate(
    model=biased_model,
    method='variance_regularization',
    train_data=training_data,
    sensitive_attr='skin_tone'
)

Continuous Monitoring

from faircheck import FairnessMonitor

# Set up production monitoring
monitor = FairnessMonitor(model=production_model)

# Track predictions over time
monitor.track(predictions, demographics)

# Get alerts when fairness drifts
if monitor.detect_drift():
    monitor.alert("Fairness threshold violated")

Supported Metrics

FairCheck implements a comprehensive suite of fairness metrics:

Category Metrics
Group Performance Accuracy, TPR, FPR, TNR, FNR per group
Disparity Measures Demographic parity, equalized odds, equal opportunity
Statistical Disparate impact ratio, statistical parity difference
Calibration Calibration error per group, ECE disparity
Custom Variance-based regularization, intersectional metrics

Why This Matters

"Fairness in AI is not a feature—it's a requirement."

As AI systems are deployed in healthcare, hiring, criminal justice, and finance, ensuring equitable treatment across demographic groups is critical. FairCheck democratizes fairness analysis, making it accessible to every ML practitioner.

Roadmap

  • Project foundation
  • Core fairness metrics module
  • PyTorch integration
  • Interactive HTML reports
  • PyPI release (v0.1.0)
  • TensorFlow integration
  • Bias mitigation algorithms
  • LLM fairness analysis
  • Production monitoring tools
  • Hugging Face Hub integration
  • Comprehensive documentation site

Contributing

We welcome contributions! FairCheck is built by the community, for the community. Whether you're fixing bugs, adding features, or improving documentation, your help is appreciated.

# Fork the repo, then:
git clone https://github.com/YOUR_USERNAME/faircheck.git
cd faircheck
pip install -e ".[dev]"
pytest

Citation

If you use FairCheck in your research, please cite:

@software{kakavand2026faircheck,
  title={FairCheck: A Library for Fairness Auditing in Machine Learning},
  author={Kakavand, Kasra},
  year={2026},
  url={https://github.com/kasra-kakavand/faircheck}
}

License

FairCheck is released under the MIT License. See LICENSE for details.

Author

Kasra Kakavand

Acknowledgments

FairCheck builds on decades of research in algorithmic fairness. Special thanks to the contributors of fairness research and the open-source ML community.


Built with care for a fairer AI future.

If you find FairCheck useful, please consider giving it a star ⭐

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

faircheck-0.1.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

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

faircheck-0.1.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file faircheck-0.1.0.tar.gz.

File metadata

  • Download URL: faircheck-0.1.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for faircheck-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4ed5e566cdf6f42d41ba5e185c8033e70ff04fb1ade35f45a9c70a81316c12d4
MD5 fb69d862cae9a7914d05753760c634a7
BLAKE2b-256 1a86d5cc6663d5f18fc0d4ba05ddfb89e816d0f6e71e6c074cd324b7f82cd71a

See more details on using hashes here.

File details

Details for the file faircheck-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: faircheck-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for faircheck-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 205ecda78dddbb06188d8b51d8676b023b65f4bf0aed243bd4744fdb0218a86e
MD5 61090e1dd1441a2119b8bdf99b327ac7
BLAKE2b-256 8eb9d5deec9e5ffb764dcbf03a1b1792038a2b85857047d84e5d898f5a316d32

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