Fairlearn is a Python package for measuring fairness and mitigating unfairness in machine learning models. It includes metrics and algorithms aimed at group-fairness harms.
Overview
Fairlearn supports developers of AI systems who need to check whether a model treats different groups unfairly and to reduce disparities where they appear. The package combines assessment metrics with mitigation methods across several common fairness definitions.
Fairness is framed in terms of harms to people: allocation harms when opportunities or resources are extended or withheld unevenly, and quality-of-service harms when the system works worse for some users even without explicit allocation differences. Relevant demographic or application groups must be chosen by the practitioner.
The toolkit is split into metrics for comparing models and groups under fairness and accuracy measures, and algorithms that adjust models for tasks under various fairness constraints. Documentation, a user guide, quickstart material, and example notebooks illustrate credit, lending, and similar scenarios.
Installation is via pip from PyPI. Fairlearn is presented as a sociotechnical aid: quantitative metrics cannot capture every notion of justice, and multiple metrics may conflict, so human judgment on trade-offs remains necessary.
Key features
- Fairness metrics for model comparison
- Unfairness mitigation algorithms
- Group fairness constraint support
- Integration with ML workflows
- Example Jupyter notebooks
- User guide and API reference
- Community Discord and Stack Overflow
- Pip install from PyPI
Use cases
- Loan or credit model review
- Hiring and admissions models
- Comparing models for group disparities
- Mitigating allocation harms
- Responsible AI assessment workflows