6.4.9 · D1AI Safety & Alignment

Foundations — Bias, fairness, and discrimination metrics

2,835 words13 min readBack to topic

This page assumes you have seen none of the notation on the parent note. We build every piece from a picture of people and boxes. By the end you will be able to read every formula there without pausing.


Start with people, not symbols

Before any letter, picture a crowd of applicants. Each person is one dot. For each dot, two facts eventually become known:

  1. What the model said about them ("we predict you will default" / "we predict you won't").
  2. What actually happened later ("they did default" / "they didn't").

That is the entire universe of these metrics. Look at the board below: every fairness idea is a way of slicing this crowd.

Figure — Bias, fairness, and discrimination metrics

Symbol 1 — : the truth

Picture: in the crowd, colour every dot by truth — one colour for , another for . This colouring exists whether or not any model was ever built. It is reality.

Why the topic needs it: you cannot say a prediction is "right" or "wrong" without a truth to compare against. is that truth.


Symbol 2 — : the guess

Picture: draw a box around the dots the model flagged. Inside the box: . Outside: . The box and the truth-colouring are two independent slicings of the same crowd — and that is the whole game.


Symbol 3 — : the group

Picture: split the entire crowd into two rooms — Room and Room . We will run the same counting recipe inside each room and then compare the two answers. Fairness = "do the rooms get similar numbers?"

Now every dot carries three tags: its truth , its prediction , and its room .


The four boxes: TP, FP, FN, TN

When you overlay "truth colour" with "prediction box," each dot lands in exactly one of four boxes. This 2×2 grid is called the confusion matrix, and it is the single most important picture on this page.

Figure — Bias, fairness, and discrimination metrics

Reading the words: the second word (Positive/Negative) is what the model said. The first word (True/False) is whether the model was right. So "False Positive" = "the positive claim was false."

Every person lands in exactly one box, so the four counts add up to the whole group: where is the total number of people in the group. Keep in mind — it is the "everyone" that fractions will divide by.

Why the topic needs it: every rate on the parent page — TPR, FPR, precision, flag-rate — is just one count divided by a total made of two counts. Learn the four boxes and every formula becomes arithmetic.


Symbol 4 — and : "what fraction"

This is the one symbol beginners fear. It is simpler than it looks.

Example from the crowd: if of people are flagged, then

Picture: the bar is a spotlight. = walk into the room named by the condition, ignore everyone else, and count the box as a fraction of that room.

Let us now name every rate the parent uses as a -with-a-bar, mapped straight to the four counts.


The named rates — each is one count over a two-count total

Figure — Bias, fairness, and discrimination metrics

Symbol 5 — the base rate

Picture: stand in one room, count only the truth-colour, ignore every prediction box. That fraction is . It is a fact about the world, not about the model.

Why the topic needs it: the parent's impossibility proof hinges on . When two groups differ in reality, the ratio-factor differs between them, and this is the wedge that forces the three fairness metrics apart. You cannot understand the Chouldechova identity without .


Symbol 6 — and how it enters Equalized Odds

Watch it actually do its job. The parent's Equalized Odds condition is written compactly as The tells you to unfold this one line into two separate equations — substitute , then : So is exactly what packs "equal TPR and equal FPR" into a single tidy formula. Without it, you would have to write both lines by hand every time.


Symbol 7 — the ratio for Disparate Impact

A tiny worked check (positive outcome = approval): approve of A and of B, with B protected:


Symbol 8 — distance , the score , and the constant

Here switches domain as promised: it is now a real-valued score in , not a flag. This is the raw confidence the model emits before thresholding.

Picture: imagine the model as a hill. is the maximum steepness allowed. If two people stand a hair apart on the input floor but the model launches one to a cliff-top score and drops the other to a valley, the hill was too steep — individual fairness is violated.

Worked check from the parent: feature gap , scores and , so output gap . With the allowance is . Since , the constraint is broken.


How it all fits together

The map below is meant to be read as a story, not memorised. Walk it with me:

  1. Three raw tags sit at the top — (truth), (prediction), (group).
  2. and collide to make the four boxes (the confusion matrix); splits everyone into group rooms.
  3. The conditional fraction turns box-counts into rates inside each room.
  4. Those rates split into two families: column-rates TPR/FPR and the row-rate PPV. Together with the base rate they feed the group-fairness metrics and the impossibility result.
  5. On a separate track, -as-a-score plus distance and constant feed individual fairness.
  6. Everything empties into the parent topic.

Y truth label

Four boxes TP FP FN TN

Y-hat prediction

A group attribute

Group rooms

Rates per group

P conditional fraction

TPR and FPR

PPV

Base rate b

Group fairness metrics

Distance d and constant L

Individual fairness

Bias fairness metrics


Where these foundations lead

  • The column-vs-row tension (TPR/FPR vs PPV) is exactly the machinery behind Fairness-accuracy tradeoffs and the impossibility result.
  • The group rooms and flag-rate ratio underpin Disparate impact theory.
  • The "similar inputs, similar outputs" idea generalises toward Counterfactual fairness and Causal fairness.
  • Auditing the boxes in the real world is the practice of Algorithmic accountability, famously on COMPAS risk assessment.
  • Layering multiple attributes at once leads to Intersectionality in ML.

Equipment checklist

Test yourself — cover the right side and answer aloud.

What does the hat in mean?
An estimate of the thing under it — here, the model's prediction of the true label .
When is a binary and when is it a real-valued score?
Binary for group metrics (TPR/FPR/PPV/DI); a score in for individual fairness, before thresholding.
What is the difference between and ?
is what actually happened; is what the model predicted. They may disagree.
Are TP, FP, FN, TN fractions or counts?
Plain whole-number head-counts; fractions come only after dividing.
What is in terms of the four boxes?
, the total people in the group.
In , what does the bar do?
Shrinks the crowd to only and swaps the denominator to that room's count, then takes the fraction.
Every equals what generic ratio?
count(box and condition) / count(condition).
Which two counts go under TPR, and what is the denominator's meaning?
TP over — everyone who truly had the event ( column).
Which counts give FPR?
FP over — everyone who truly did not have the event ( column).
Which counts give precision (PPV) and why is its denominator a row?
TP over — everyone the model flagged ( row).
What is the base rate ?
— the fraction of a group that truly has the event, ignoring the model.
How does unfold Equalized Odds?
Into two equations — gives equal TPR, gives equal FPR across groups.
What does the Lipschitz constant bound?
How fast scores may change relative to input change: output gap input gap.
Compute Disparate Impact if protected group is flagged 40% and privileged 60% (positive outcome).
, below , so it fails the screen.
Recall Quick self-check answer key

If you can state all fourteen aloud without peeking, you are ready for the parent note's derivations. If TPR-vs-PPV (column vs row) still feels fuzzy, re-read the confusion-matrix figure — that single distinction powers the impossibility theorem.