6.4.9 · D2AI Safety & Alignment

Visual walkthrough — Bias, fairness, and discrimination metrics

2,005 words9 min readBack to topic

This page assumes nothing. We will build every symbol — , , TPR, FPR, PPV, base rate — from a picture of dots before we ever write a fraction. Everything below extends the parent topic.


Step 1 — Two piles of people, and the one thing we can't see

WHAT. Picture 1000 loan applicants as dots. Some of them will default (fail to repay) — but we don't know who yet. Nature has secretly colored each dot.

WHY. Before any model exists, there is a hidden truth. Every fairness idea is really a question about how our guesses line up against this hidden truth, so we must draw it first.

PICTURE.

The yellow dots are people who will actually default. We write that hidden truth as a label :

  • ::: the ground-truth outcome nature assigns — = actually defaults, = actually repays. We can only see it later on labeled historical data.

The fraction of yellow dots is the base rate:

  • ::: base rate — the slice of a group that truly defaults. In Step 3 this single number becomes the villain.

Here is the protected attribute: means "Group A," means "Group B" (think: two demographic groups the law protects).


Step 2 — The model draws a line: predictions appear

WHAT. Now a machine-learning model looks at each applicant's features and guesses. Its guess is (read "Y-hat" — the hat means "estimated"). Flagged applicants () get denied.

WHY. A prediction is separate from the truth. Confusing "what the model said" with "what was true" is the single most common mistake in fairness math — so we give them different letters and different colors now.

PICTURE.

The model draws a boundary. Everyone on the "risky" side is flagged (); everyone else is cleared ().

  • ::: the model's prediction; = "we think this person defaults" (→ deny the loan), = "we clear them."

Step 3 — Sorting into four bins: the confusion matrix

WHAT. Cross the truth () with the guess (). Four bins appear. Every applicant lands in exactly one.

WHY. These four counts are the atoms of every fairness metric. Build them once as areas, and each metric becomes "one area divided by another."

PICTURE.

The four bins, named:

  • TP (true positive) ::: yellow dot, correctly flagged — a real defaulter we caught.
  • FP (false positive) ::: navy dot, wrongly flagged — a good applicant we denied.
  • FN (false negative) ::: yellow dot, wrongly cleared — a defaulter we let through.
  • TN (true negative) ::: navy dot, correctly cleared.

Now three ratios built from these bins. Each answers a plain-English question.

  • TPR (true positive rate) reads down the column — a property of how we treat real defaulters.
  • FPR (false positive rate) reads down the column — how we treat real repayers.
  • PPV (positive predictive value, a.k.a. precision) reads across the row — how much you can trust a flag.

Notice: TPR and FPR look at the truth first and ask what the model did. PPV starts from the flag and asks what the truth was. That flip is the whole story.


Step 4 — Bridging the rates: the total-probability identity

WHAT. We express "how often the model flags anyone" using TPR, FPR, and the base rate .

WHY. We need one equation that contains TPR, FPR, PPV, and all together — because the impossibility appears only when those four are locked in a single relationship. This step forges that link.

PICTURE.

Every flagged person is either a caught defaulter (from the slice) or a wrongly-flagged repayer (from the slice). Split the flag rate accordingly:

  • ::: fraction of the whole group that is a correctly-flagged defaulter (catch rate × the yellow slice).
  • ::: fraction that is a wrongly-flagged repayer (false-alarm rate × the navy slice).

This is just the law of total probability: to count all flags, count the flags in each colored slice and add. The two green bars in the figure are exactly these two terms.


Step 5 — Precision from the same bins: the Chouldechova identity

WHAT. Write PPV using the pieces from Step 4, then solve for FPR.

WHY. Precision is the trust question — the thing that ends up unequal. By rebuilding PPV out of TPR, FPR, and , we can make appear inside the precision equation, which is where the trap springs.

PICTURE.

Precision = true positives ÷ all flags. The numerator is the first green bar; the denominator is both green bars:

Now do one line of algebra — solve this for FPR. (Cross-multiply, isolate the FPR term.)

  • ::: the base-rate factor — how many real defaulters there are per real repayer. This is the only term that carries the group's identity.
  • ::: the untrust ratio — false flags per correct flag. Small when precision is high.
  • ::: the catch rate, riding along.

Step 6 — The trap springs: equal errors ⇒ unequal trust

WHAT. Demand Equalized Odds: force TPR and FPR to be identical across both groups. Watch what happens to PPV.

WHY. Equalized Odds is the "errors shouldn't concentrate in one group" fairness ideal. It looks harmless. Step 5 lets us see the price.

PICTURE.

Write the identity for each group and impose and . Those equal pieces cancel, leaving only:

Plug in the base rates , :

The two base-rate factors are different (). For the equation to still balance, the untrust ratios must compensate — which means:

The trust in a flag is forced to differ between groups. You wanted equal error rates; you got unequal precision. That is Predictive Parity broken by construction.


Step 7 — Degenerate cases: when the conflict vanishes

WHAT. The one situation where all three metrics can hold at once.

WHY. The contract says: cover the edge cases. The impossibility has an escape hatch — and seeing it makes the mechanism crisp.

PICTURE.

Look again at the collapsed equation in Step 6. It becomes an identity automatically — no conflict — exactly when:

  • Equal base rates, . Then the base-rate factors match, and equal error rates do give equal precision. (In our loan story , so no luck.)
  • A perfect classifier (), which forces for everyone — but then Demographic Parity fails whenever base rates differ.
  • or (nobody defaults, or everybody does): the ratios degenerate, is or undefined, and "fairness" is vacuous — there is nothing to be unfair about.
Recall When can all three coexist?

All three group metrics hold simultaneously only if the base rates are equal, or the classifier is perfect, or a group is degenerate ::: yes — in every realistic case (imperfect model, unequal base rates), at least one metric must break.


The one-picture summary

The whole derivation compressed: two groups → four bins → three rates → one identity → forced inequality. The base-rate gap ( vs ) is the crack that runs through everything.

Recall Feynman retelling — say it to a friend

Imagine two neighborhoods. In one, half the people would genuinely default; in the other, only three in ten. You build a loan model and you're determined to be fair, so you make it miss real defaulters at the same rate in both places, and raise false alarms at the same rate in both places — equal mistakes, feels square.

But "how much you can trust a red flag" isn't just about your mistake rates — it's diluted by how many real defaulters exist to begin with. Where defaulters are rare, more of your flags are false alarms, so a flag there means less. You matched the error rates, but the different amounts of real defaulters bleed straight through into the meaning of a flag. One neighborhood's flags become less trustworthy than the other's — automatically. You never chose to discriminate; the arithmetic of "half vs three-in-ten" did it for you. The only ways out are: make the two neighborhoods have the same true default fraction (you can't — that's the world), or build a perfect model (you can't — models err). So fairness has to be chosen, not solved: you pick which fairness to keep, knowing you're spending another.

Related paths from here: Disparate impact theory, Fairness-accuracy tradeoffs, Causal fairness, Counterfactual fairness, and the real-world blowup in COMPAS risk assessment. Zooming out: Algorithmic accountability and Intersectionality in ML.