Fairness Metrics — and Why They Conflict
P15.fairness-privacy.02 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Where Bias Enters
Where next?
Later in Fairness & Privacy
This module unlocks
P15.fairness-privacy.02 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Where Bias Enters
Later in Fairness & Privacy
This module unlocks
"The model was unfair" is an accusation, not a measurement. Before you can fix unfairness — or defend against the charge of it — you have to say precisely what you mean, in numbers a second person could check. That turns out to be harder than it sounds, because there is more than one reasonable way to define a fair decision, and this module's central, unsettling result is that two of the most natural definitions cannot both be satisfied at once when the groups differ in how often the good outcome actually occurs. Fairness is not one target you can hit if you try hard enough; it is a set of targets that pull against each other, and choosing among them is a value judgement no formula can make for you. We build the two definitions on a tiny, hand-checkable cohort, watch them disagree, and see why the disagreement is not a bug you can engineer away.
Picture a model that approves or rejects applicants, and split the people it judges into two groups, A and B. What would make its decisions fair? Two answers both sound obviously right — and they are different answers.
| Definition | Requires | The intuition |
|---|---|---|
| Demographic parity | equal approval rate across groups | "the same share of each group should be approved" |
| Equalized odds | equal true-positive rate AND equal false-positive rate | "the model should be equally accurate, and equally wrong, for each group" |
Why it matters — These two definitions answer different moral questions, which is why they can conflict. Demographic parity cares only about the bottom line — did each group get approved at the same rate? — regardless of who was actually qualified. Equalized odds cares about the model's error behaviour — among genuinely qualified people, is it as likely to say yes for either group; among unqualified people, is it as likely to wrongly say yes? One asks 'are the outcomes equal?'; the other asks 'are the mistakes equal?'. A given classifier can honour one and violate the other, so you cannot say a model is 'fair' without saying which fairness you mean.
The vocabulary of true- and false-positive rates comes straight from the confusion matrix you met in evaluation — see Evaluation Metrics (P5) for the mechanics. The new move here is to compute those rates once per group and compare.
This series recalls Where Bias Enters and Fairness Metrics — and Why They Conflict.
Self-check
A hiring model trained on a company's past hires ends up favouring men, though nobody wrote a rule telling it to. How did the preference get into the model?
Self-check
Which fairness definition asks only that each group is approved at the same rate, whoever in it is truly qualified?
Self-check
A postcode column lets a model work out applicants' ethnicity even though the ethnicity column was deleted. What is the postcode acting as?
Self-check
A hospital score is trained to predict which patients were given extra nursing in the past, and doctors used to under-refer older patients. Where does bias mainly enter?
Self-check
A loan model approves the same share of applicants in both groups. Among people who would truly repay, though, it says yes far more often in group A than in group B. Which definition does it meet?
Self-check
A speech app reports 95 % accuracy overall, yet users with one regional accent, a small share of all users, say it rarely understands them. What let the headline figure hide this?
Self-check
A city must choose a fairness rule for a scholarship model whose labels, past awards, are known to have favoured one district. Which choice does the lesson's guidance support?
Self-check
A manager says: our groups differ in how many people are truly qualified, but a skilled team will still reach, with a real and imperfect model, a zero parity gap and a zero odds gap. What is wrong?
Self-check
A team deletes the gender, age and ethnicity columns and declares its screener fair. What did they overlook?
Self-check
A hiring screener, retrained each year on the people it hired, is launched; the team checks per-group accuracy once, finds it equal, and turns monitoring off for good. Why is that risky?
For the it-ml track: the conflict above is not folklore, it is a theorem. Kleinberg, Mullainathan and Raghavan (2017) and, in a parallel result, Chouldechova (2017) prove that three intuitive fairness conditions cannot simultaneously hold whenever the base rates differ and the classifier is imperfect.
Fix a group with base rate p (the fraction actually positive). Consider three
conditions on a risk score:
r, a fraction
r really are positive, in every group.The theorem: if two groups have different base rates (p_A ≠ p_B) and the model is
not a perfect predictor, then no score can satisfy all three at once. The only
escape hatches are the degenerate ones — perfect prediction (never available on real
data) or equal base rates (not true of the populations we actually screen).
The intuition tracks the base-rate blend from the main text. Calibration ties a score's meaning to the group's base rate; the two balance conditions demand the score distributions line up across groups regardless of base rate. When base rates differ, these pull apart, and something has to give. This is why the threshold sweep in the senior rung finds a strictly-positive residual gap: the frontier's floor is the theorem made numerical. The practical upshot is unchanged — pick the condition your context most needs, quantify the violation of the others, and put that number in the model card.
Practise this lesson's 10 self-checks
One per screen: 10 checked on this page, 0 you reveal and mark yourself. Nothing is recorded.
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.
Now measure fairness yourself. Each rung is a three-panel workspace: instructions on the left, a code editor in the middle, output and test results on the right. Run checks the visible tests; Submit grades against hidden cohorts. The explorer rung reads the parity gap off per-group approval rates; the practitioner rungs build per-group confusion matrices and compute both gaps on a cohort where they disagree; the senior rung sweeps per-group thresholds to find the frontier and the residual gap that proves you cannot zero both.
Loading exercise…
Loading exercise…
Loading exercise…
Loading exercise…
A scratch console for this page's ideas — ungraded, nothing you run here is recorded.
Scratch console
A scratch console with the scientific stack (pandas, numpy, scikit-learn). Runs on the server — no network, resource-limited and measured.
Output appears here.
Loading your notes...