Fairlearn
noun
say it: “FAIR-lurn” /ˈfɛrˌlɝn/
A free Python package of tools for measuring how fairly a machine learning model treats different groups of people, and for reducing unfair gaps.
What is Fairlearn?
Fairlearn is a Python package for checking and improving a model's fairness. Its MetricFrame splits any score by
a sensitive feature so you can compare groups, and it measures gaps such as demographic_parity_difference() and
equalized_odds_difference(). It also has methods that shrink the gaps.
from fairlearn.metrics import MetricFrame, selection_rate
qualified = [1, 0, 1, 0, 1, 0, 1, 0]
invited = [1, 1, 1, 0, 1, 0, 0, 0]
district = ["N", "N", "N", "N", "S", "S", "S", "S"]
frame = MetricFrame(metrics=selection_rate, y_true=qualified, y_pred=invited, sensitive_features=district)
print(frame.by_group.to_dict()) # {'N': 0.75, 'S': 0.25}
In a sentence
- “The MetricFrame from Fairlearn showed each district's selection rate side by side.”
- “She installed Fairlearn to measure the screen's equalized odds.”
Level: Journeyman · More Python terms at this level
Updated