An open-source Python library that breaks model performance down by subgroup and offers algorithms to reduce the gaps you find.
| Website | https:// |
| Source code | https:// |
| Developed by | Fairlearn community (originally Microsoft) |
| Type | Software library: Python package |
| Lifecycle phase | Development, Evaluation |
| FUTURE-AI | Fairness |
| For | AI developers, Researchers |
| Facilitation | No facilitator needed |
| Skills needed | Python, scikit-learn |
| Cost | Free |
| Languages | English |
| Maturity | Established |
| Licence | MIT |
What it is¶
Fairlearn’s MetricFrame lets you compute any scikit-learn style metric, such as sensitivity or calibration error, for every subgroup at once and report the differences or ratios between them. Its mitigation module includes reduction-based training methods and threshold post-processing that trade off overall accuracy against fairness constraints. The project began at Microsoft and is now run as a community-driven open-source project, with user guides that stress that fairness is a sociotechnical question rather than a purely technical one.
In healthcare¶
For a clinical prediction model you can use Fairlearn to report sensitivity, specificity or other metrics separately for groups such as sex, age band or hospital site, which is what subgroup analyses in clinical evaluation call for. You still need to add confidence intervals and judge clinical significance yourself, because small subgroups make point estimates unstable.
Where to use it in The ELSA Way¶
Fairness and bias assessment › Measuring performance disparities: MetricFrame computes your primary metrics per subgroup and the largest between-group difference in one step, giving you the subgroup estimates this passage asks you to report.
Data quality and fairness › Bias correction techniques: Its reduction methods add fairness constraints to training and its threshold optimiser adjusts outputs per group, two practical ways to apply bias-aware correction.
References¶
Weerts H, Dudík M, Edgar R, Jalali A, Lutz R, Madaio M. Fairlearn: Assessing and Improving Fairness of AI Systems. Journal of Machine Learning Research. 2023;24(257):1-8. https://
www .jmlr .org /papers /v24 /23 -0389 .html
Related tools¶
AI Fairness 360: An open-source Python and R toolkit for measuring bias in datasets and models and for trying out algorithms that reduce it before, during or after training.
SHAP: A Python library that explains individual predictions by estimating how much each input feature pushed the model’s output up or down, based on Shapley values from game theory.