skillfed

fairlearn

A Python package to assess and improve fairness of machine learning models.

fairlearn v0.14.0 209.3K downloads/30d#9,516 on PyPI2,268
Permissive license Active released

What it is and what it does

Fairlearn is a Python package for assessing and mitigating fairness in AI systems, focusing on harms that occur when models treat different groups of people unequally. It operationalizes fairness through a group fairness approach, asking which groups are at risk for experiencing harms—either allocation harms (when opportunities or resources are withheld) or quality-of-service harms (when a system works differently for different people). The package provides two main components: metrics for identifying which groups are negatively impacted by a model and comparing models across fairness and accuracy trade-offs, and mitigation algorithms that reduce unfairness across various AI tasks and fairness definitions.

The package depends on standard data science libraries (numpy, pandas, scikit-learn, scipy) and narwhals, and supports Python 3.10 through 3.13. It is actively maintained with a release history dating back to 2018, and the repository shows recent activity. The package acknowledges that fairness is fundamentally a sociotechnical challenge—quantitative metrics alone cannot capture all aspects like justice or due process, and not all fairness metrics can be satisfied simultaneously. Its role is to enable practitioners to assess different mitigation strategies and make trade-offs appropriate to their specific scenario.

Use it for:

  • Assess hiring or lending models to detect whether they systematically disadvantage protected groups before deployment
  • Measure and compare fairness metrics across multiple candidate models to inform model selection decisions
  • Apply post-processing mitigation algorithms to adjust model predictions to satisfy fairness constraints like demographic parity
  • Evaluate quality-of-service fairness to ensure a recommendation or classification system works equally well across demographic groups
  • Generate fairness reports for stakeholders to document which groups experience harms and what trade-offs were made

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Fairlearn assesses and mitigates fairness issues in machine learning models by providing metrics to identify which groups are negatively impacted and algorithms to reduce unfairness across various AI tasks.

Yes. Fairlearn is actively maintained, has low install friction, carries a permissive license, and addresses a real need in responsible AI development. It is appropriate for teams building production ML systems that must account for fairness across demographic groups. The package is mature enough for practical use (Alpha status reflects ongoing development, not instability) and has substantial adoption. Install it if fairness assessment or mitigation is part of your model development workflow.

Install

fairlearn on PyPI

pip

pip install fairlearn

uv

uv add fairlearn

poetry

poetry add fairlearn

Installing fairlearn

Before you install

Low install friction with a pure Python wheel and five well-established dependencies (numpy, pandas, scikit-learn, scipy, narwhals). Active maintenance with a release 68 days ago and ongoing repository activity.

License in practice

Permissive license allows unrestricted use, modification, and distribution in commercial and private projects without copyleft obligations.

Quickstart

pip install fairlearn

from fairlearn.metrics import MetricFrame
from fairlearn.postprocessing import ThresholdOptimizer
import pandas as pd

# Assess fairness across groups
metric_frame = MetricFrame(metrics={...}, y_true=y, y_pred=y_pred, groups=groups)

# Mitigate unfairness
mitigator = ThresholdOptimizer(estimator=model, constraints='demographic_parity')
mitigator.fit(X_train, y_train, sensitive_features=sensitive_train)

Verify before relying

  • Whether narwhals is used as a dataframe abstraction layer or for a specific feature
  • Specific fairness constraint types and mitigation algorithms available beyond the description
  • Performance characteristics when applied to large datasets or high-dimensional sensitive features

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 5 — narwhals, numpy, pandas, scikit-learn, scipy
Maintenance actively maintained — 68 days since the last release
Last repo commit
First released
Downloads 209,288/month — #9,516 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: fairlearn-0.14.0-py3-none-any.whl

Development Status :: 3 - AlphaLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13

Tags

machine learning fairness assessmentbias detection and mitigationgroup fairness metricsalgorithmic fairness toolsmodel fairness evaluationAI bias mitigationfairness constraints for ML
fairness-biasmodel-evaluationresponsible-ai

More Artificial Intelligence packages

Further reading