SyntaxPilot
Courses/Machine Learning/Lesson 84
Video coming soonThis lesson’s video is being made

Start with the notes below; the video appears here as soon as it is on YouTube.

Machine Learning · Lesson 84 of 90

Fairness and responsible ML

bias sources (historical, sampling, measurement)protected attributesproxy featuresdemographic parityequalised oddsequal opportunitydisparate impactfairness-accuracy trade-offpre-in- and post-processing mitigationmodel cardsdatasheets for datasetsprivacy basics

Machine Learning Full Course · Episode 84. Every program below was run on a Linux machine with Python 3.13, NumPy 2.5.3, pandas 3.0.5, scikit-learn 1.9.1 and fairlearn 0.15.0, and the output shown is the real output. All data is made up. The "past managers" bias is built into the made-up labels on purpose (half of the qualified women were rejected), so we can see how a model inherits it.

The big idea: a model trained on past decisions copies the unfairness in them. Removing the protected column ("fairness through unawareness") fails, because proxy features carry the same information. So we measure fairness per group (demographic parity, equal opportunity, equalised odds, disparate impact), reduce unfairness before, during or after training, document models and datasets honestly (model cards, datasheets), and protect privacy beyond deleting names.

Sources: US Uniform Guidelines on Employee Selection Procedures, 29 CFR 1607.4(D): "A selection rate for any race, sex, or ethnic group which is less than four-fifths (4/5) (or eighty percent) of the rate for the group with the highest rate will generally be regarded by the Federal enforcement agencies as evidence of adverse impact". Margaret Mitchell et al., Model Cards for Model Reporting (FAT* 2019): "Model cards are short documents accompanying trained machine learning models" that report evaluation across groups and "disclose the context in which models are intended to be used". Timnit Gebru et al., Datasheets for Datasets (2018): every dataset should be accompanied by a datasheet documenting its motivation, composition, collection process and recommended uses, as electronic components come with datasheets.

Words you need first

  • True positive rate (TPR, recall): of the people who really are positive (qualified), the share the model picks (Episode 24).
  • False positive rate (FPR): of the people who really are negative (not qualified), the share the model wrongly picks (Episode 24).
  • Sample weight: a number telling the model how much each training row counts; weight 2 = counts twice.
  • Threshold: the probability above which we say "yes" (Episode 22); 0.5 by default.
  • Cross-validation: scoring a model on several train/test splits and averaging (Episode 26).

The story: shortlisting CVs

A company wants a model to shortlist CVs. It has 6,000 past applicants: skill test score, years of experience, and career gap (years away from work). The label is "hired", decided by past managers. Gender is a protected attribute: a trait that law or ethics says must not decide the outcome (others: religion, caste, age, disability). The obvious attempt: delete the gender column.

import numpy as np
rng, n = np.random.default_rng(84), 6000                       # made-up past job applicants
woman, skill, exp_years = rng.random(n) < 0.5, rng.normal(70, 10, n), rng.normal(6, 2, n).clip(0)
gap = np.where(woman, rng.random(n) < 0.6, rng.random(n) < 0.1) * rng.integers(1, 4, n)   # career gap
qualified = (skill + 2 * exp_years + rng.normal(0, 5, n) > 85).astype(int)   # the truth (found later)
hired = (qualified & ~(woman & (rng.random(n) < 0.5))).astype(int)   # past bosses: half the good women out
X = np.c_[skill, exp_years, gap]                               # no gender column
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
# "fair by unawareness": the gender column is NOT given to the model
Xtr, Xte, ytr, yte, wtr, wte = train_test_split(X, hired, woman, random_state=0)
model = LogisticRegression(max_iter=1000).fit(Xtr, ytr)
pick = model.predict(Xte)
rate_m, rate_w = pick[~wte].mean(), pick[wte].mean()
print(f"shortlisted: men {rate_m:.2f}   women {rate_w:.2f}")
print(f"disparate impact (women / men): {rate_w / rate_m:.2f}")
print("weights for skill, experience, career gap:", np.round(model.coef_[0], 2))
shortlisted: men 0.31   women 0.22
disparate impact (women / men): 0.70
weights for skill, experience, career gap: [ 0.19  0.39 -0.35]

Men are shortlisted 31% of the time, women 22%: women are picked only 0.70 times as often. And the model gave career gap a negative weight: it found another road to the same bias.

Real-life example: picking the school cricket team

School team selection In ML
Old team lists from years when girls weren't allowed to play Historical bias: labels copy past unfairness
Trials held only in one big city; village players never seen Sampling bias: some groups missing or rare
One ground's stopwatch runs slow; its runners look slower Measurement bias: a feature measured worse for a group
  • Historical bias: the world (or past decisions) was unfair, and the data records it faithfully. Our "hired" labels.
  • Sampling bias: the data doesn't represent everyone the model will serve, e.g. a skin-disease model trained on photos from one hospital.
  • Measurement bias: a feature or label is measured less accurately for some group, e.g. "arrests" used as a measure of "crime" when some areas are policed more.

Proxy features

A proxy feature is an innocent-looking feature that reveals a protected attribute: career gap → gender, pincode → religion or caste, first name → gender. "Fairness through unawareness" (just drop the column) fails whenever proxies exist. Test it: can each remaining feature guess gender?

import numpy as np
rng, n = np.random.default_rng(84), 6000                       # made-up past job applicants
woman, skill, exp_years = rng.random(n) < 0.5, rng.normal(70, 10, n), rng.normal(6, 2, n).clip(0)
gap = np.where(woman, rng.random(n) < 0.6, rng.random(n) < 0.1) * rng.integers(1, 4, n)   # career gap
qualified = (skill + 2 * exp_years + rng.normal(0, 5, n) > 85).astype(int)   # the truth (found later)
hired = (qualified & ~(woman & (rng.random(n) < 0.5))).astype(int)   # past bosses: half the good women out
X = np.c_[skill, exp_years, gap]                               # no gender column
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import cross_val_score
# can the "gender-blind" features still tell who is a woman?
for name, cols in [("skill", [0]), ("experience", [1]), ("career gap", [2])]:
    acc = cross_val_score(DecisionTreeClassifier(max_depth=3), X[:, cols], woman, cv=5).mean()
    print(f"guess gender from {name:10}: accuracy {acc:.2f}  (coin flip 0.50)")
print(f"women with a career gap: {(gap[woman] > 0).mean():.2f}   men: {(gap[~woman] > 0).mean():.2f}")
guess gender from skill     : accuracy 0.51  (coin flip 0.50)
guess gender from experience: accuracy 0.51  (coin flip 0.50)
guess gender from career gap: accuracy 0.75  (coin flip 0.50)
women with a career gap: 0.59   men: 0.09

Skill and experience: 0.51, a coin flip, safe. Career gap: 0.75: 59% of women have a gap vs 9% of men. That's the proxy.

Measuring fairness

Real-life example: a fair ticket checker?

On a train In ML
Check the same share of men and women Demographic parity: equal pick rate
Among ticketless travellers, catch the same share in each group Equal opportunity: equal TPR
...and wrongly fine honest travellers equally rarely Equalised odds: equal TPR and FPR

The four numbers

  • Demographic parity: pick rate (share shortlisted) equal across groups.
  • Equal opportunity: TPR equal: qualified people are shortlisted equally often in each group.
  • Equalised odds: TPR and FPR equal: unqualified people are also wrongly picked equally often.
  • Disparate impact ratio: pick rate of a group ÷ pick rate of the highest group. The US four-fifths rule: below 0.80 is generally treated as evidence of adverse impact.
import numpy as np
rng, n = np.random.default_rng(84), 6000                       # made-up past job applicants
woman, skill, exp_years = rng.random(n) < 0.5, rng.normal(70, 10, n), rng.normal(6, 2, n).clip(0)
gap = np.where(woman, rng.random(n) < 0.6, rng.random(n) < 0.1) * rng.integers(1, 4, n)   # career gap
qualified = (skill + 2 * exp_years + rng.normal(0, 5, n) > 85).astype(int)   # the truth (found later)
hired = (qualified & ~(woman & (rng.random(n) < 0.5))).astype(int)   # past bosses: half the good women out
X = np.c_[skill, exp_years, gap]                               # no gender column
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
Xtr, Xte, ytr, yte, wtr, wte, qtr, qte = train_test_split(X, hired, woman, qualified, random_state=0)
pick = LogisticRegression(max_iter=1000).fit(Xtr, ytr).predict(Xte)
rows = {"pick rate": np.ones_like(wte), "TPR": qte == 1, "FPR": qte == 0}   # who we look at
notes = {"pick rate": "demographic parity", "TPR": "equal opportunity", "FPR": "equalised odds: TPR and FPR"}
print("            men   women   gap")
for k, m in rows.items():
    a, b = pick[~wte & m].mean(), pick[wte & m].mean()
    print(f"{k:11} {a:.2f}  {b:.2f}   {a - b:.2f}   <- {notes[k]}")
print(f"disparate impact {pick[wte].mean() / pick[~wte].mean():.2f}  (four-fifths rule: < 0.80 = red flag)")
            men   women   gap
pick rate   0.31  0.22   0.09   <- demographic parity
TPR         0.66  0.54   0.12   <- equal opportunity
FPR         0.04  0.02   0.02   <- equalised odds: TPR and FPR
disparate impact 0.70  (four-fifths rule: < 0.80 = red flag)

(qualified is the truth from a later skills check, which we have only because the data is made up. In real projects such ground truth is rare, which is part of why fairness is hard.) Pick-rate gap 0.09 (demographic parity fails), TPR 0.66 vs 0.54 (equally qualified women are shortlisted less: equal opportunity fails), FPRs close, disparate impact 0.70 < 0.80.

You can't have every fairness at once

When groups really differ in how often the label is positive (different base rates), these definitions cannot all hold together; it is a mathematical conflict, not a bug. Choose the definition that fits the harm: missing a qualified candidate, rejecting a good borrower and missing a disease are different harms. The fairness-accuracy trade-off: pushing a model towards fairness can cost some accuracy, but accuracy measured against biased labels rewards copying the bias.

Fixing it: pre-, in- and post-processing

In the kitchen In ML
Wash and sort the dal before cooking Pre-processing: fix the data
Watch the flame while it cooks In-processing: a fairness rule inside training
Adjust the salt at the end Post-processing: change decisions/thresholds per group
  • Pre-processing, reweighing: weight each (group, label) pair by P(group)·P(label) / P(group, label), so rare pairs like "hired women" count more, as if group and label were independent.
  • In-processing: fairlearn's ExponentiatedGradient trains any scikit-learn model while obeying a constraint like DemographicParity.
  • Post-processing: fairlearn's ThresholdOptimizer picks a separate threshold per group to meet a goal.
  • fairlearn: an open-source Python library for measuring and reducing unfairness.

Pre-processing first (no fix vs reweighing):

import numpy as np
rng, n = np.random.default_rng(84), 6000                       # made-up past job applicants
woman, skill, exp_years = rng.random(n) < 0.5, rng.normal(70, 10, n), rng.normal(6, 2, n).clip(0)
gap = np.where(woman, rng.random(n) < 0.6, rng.random(n) < 0.1) * rng.integers(1, 4, n)   # career gap
qualified = (skill + 2 * exp_years + rng.normal(0, 5, n) > 85).astype(int)   # the truth (found later)
hired = (qualified & ~(woman & (rng.random(n) < 0.5))).astype(int)   # past bosses: half the good women out
X = np.c_[skill, exp_years, gap]                               # no gender column
from sklearn.linear_model import LogisticRegression as LR
from sklearn.model_selection import train_test_split
Xtr, Xte, ytr, yte, wtr, wte, qtr, qte = train_test_split(X, hired, woman, qualified, random_state=0)
def show(name, p, t=lambda p, g: p[(wte == g) & (qte == 1)].mean()):     # accuracy, then fairness
    print(f"{name:16} past {(p == yte).mean():.3f}  truth {(p == qte).mean():.3f}"
          f"  DI {p[wte].mean() / p[~wte].mean():.2f}  TPR gap {t(p, False) - t(p, True):+.2f}")
show("no fix", LR(max_iter=1000).fit(Xtr, ytr).predict(Xte))
w = [np.mean(wtr == a) * np.mean(ytr == b) / np.mean((wtr == a) & (ytr == b)) for a, b in zip(wtr, ytr)]
show("pre: reweigh", LR(max_iter=1000).fit(Xtr, ytr, sample_weight=w).predict(Xte))   # rare pairs count more
no fix           past 0.812  truth 0.821  DI 0.70  TPR gap +0.12
pre: reweigh     past 0.810  truth 0.829  DI 0.78  TPR gap +0.05

Then in-processing and post-processing (same data, same split, same show):

import numpy as np
rng, n = np.random.default_rng(84), 6000                       # made-up past job applicants
woman, skill, exp_years = rng.random(n) < 0.5, rng.normal(70, 10, n), rng.normal(6, 2, n).clip(0)
gap = np.where(woman, rng.random(n) < 0.6, rng.random(n) < 0.1) * rng.integers(1, 4, n)   # career gap
qualified = (skill + 2 * exp_years + rng.normal(0, 5, n) > 85).astype(int)   # the truth (found later)
hired = (qualified & ~(woman & (rng.random(n) < 0.5))).astype(int)   # past bosses: half the good women out
X = np.c_[skill, exp_years, gap]                               # no gender column
from sklearn.linear_model import LogisticRegression as LR
from sklearn.model_selection import train_test_split
from fairlearn.reductions import ExponentiatedGradient, DemographicParity
from fairlearn.postprocessing import ThresholdOptimizer
Xtr, Xte, ytr, yte, wtr, wte, qtr, qte = train_test_split(X, hired, woman, qualified, random_state=0)
def show(name, p, t=lambda p, g: p[(wte == g) & (qte == 1)].mean()):     # accuracy, then fairness
    print(f"{name:16} past {(p == yte).mean():.3f}  truth {(p == qte).mean():.3f}"
          f"  DI {p[wte].mean() / p[~wte].mean():.2f}  TPR gap {t(p, False) - t(p, True):+.2f}")
eg = ExponentiatedGradient(LR(max_iter=1000), DemographicParity()).fit(Xtr, ytr, sensitive_features=wtr)
show("in: constraint", eg.predict(Xte, random_state=0))
to = ThresholdOptimizer(estimator=LR(max_iter=1000), constraints="demographic_parity", predict_method="predict_proba")
show("post: thresholds", to.fit(Xtr, ytr, sensitive_features=wtr).predict(Xte, sensitive_features=wte, random_state=0))
in: constraint   past 0.811  truth 0.829  DI 0.76  TPR gap +0.07
post: thresholds past 0.807  truth 0.835  DI 0.84  TPR gap +0.05

Disparate impact 0.70 → 0.78 / 0.76 / 0.84 (thresholds clear the four-fifths line), TPR gap 0.12 → about 0.05. Against the biased past labels accuracy drops slightly (0.812 → 0.807); against the truth it rises (0.821 → 0.835). Note: in-processing here only sees skill, experience and career gap, so it can't fully equalise; and real projects check several metrics after every fix.

Mistake: predicting without the group

import numpy as np
rng, n = np.random.default_rng(84), 6000                       # made-up past job applicants
woman, skill, exp_years = rng.random(n) < 0.5, rng.normal(70, 10, n), rng.normal(6, 2, n).clip(0)
gap = np.where(woman, rng.random(n) < 0.6, rng.random(n) < 0.1) * rng.integers(1, 4, n)   # career gap
qualified = (skill + 2 * exp_years + rng.normal(0, 5, n) > 85).astype(int)   # the truth (found later)
hired = (qualified & ~(woman & (rng.random(n) < 0.5))).astype(int)   # past bosses: half the good women out
X = np.c_[skill, exp_years, gap]                               # no gender column
from sklearn.linear_model import LogisticRegression
from fairlearn.postprocessing import ThresholdOptimizer
to = ThresholdOptimizer(estimator=LogisticRegression(max_iter=1000),
                        constraints="demographic_parity", predict_method="predict_proba")
to.fit(X, hired, sensitive_features=woman)
new_people = X[:5]
print(to.predict(new_people, random_state=0))       # which of these 5 to shortlist?
Traceback (most recent call last):
  File "f5x.py", line 14, in <module>
    print(to.predict(new_people, random_state=0))       # which of these 5 to shortlist?
          ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ThresholdOptimizer.predict() missing 1 required keyword-only argument: 'sensitive_features'

Group thresholds need each person's group at decision time:

import numpy as np
rng, n = np.random.default_rng(84), 6000                       # made-up past job applicants
woman, skill, exp_years = rng.random(n) < 0.5, rng.normal(70, 10, n), rng.normal(6, 2, n).clip(0)
gap = np.where(woman, rng.random(n) < 0.6, rng.random(n) < 0.1) * rng.integers(1, 4, n)   # career gap
qualified = (skill + 2 * exp_years + rng.normal(0, 5, n) > 85).astype(int)   # the truth (found later)
hired = (qualified & ~(woman & (rng.random(n) < 0.5))).astype(int)   # past bosses: half the good women out
X = np.c_[skill, exp_years, gap]                               # no gender column
from sklearn.linear_model import LogisticRegression
from fairlearn.postprocessing import ThresholdOptimizer
to = ThresholdOptimizer(estimator=LogisticRegression(max_iter=1000),
                        constraints="demographic_parity", predict_method="predict_proba")
to.fit(X, hired, sensitive_features=woman)
new_people = X[:5]
print(to.predict(new_people, sensitive_features=woman[:5], random_state=0))   # fix
[1 1 1 0 1]

The cost: post-processing requires collecting and using the protected attribute when deciding, which some laws or company policies don't allow. Check before choosing it.

Documentation: model cards and datasheets

In a shop In ML
A food packet's label: ingredients, who shouldn't eat it Model card
An electronic part's datasheet: how it was made, safe limits Datasheet for datasets
  • Model card (Mitchell et al., 2019): a short document accompanying a trained model: intended use, out-of-scope uses, metrics per group, limitations, training data, ethical considerations.
  • Datasheet for datasets (Gebru et al., 2018): the dataset's motivation, composition, collection process, preprocessing, recommended uses, distribution and maintenance.

Ours would honestly say: "Labels are past hiring decisions and carry known bias against women; career gap is a gender proxy; disparate impact was 0.70 before mitigation, 0.84 after threshold post-processing; not for use without human review."

Privacy basics

  • Personal data: anything that can identify a person, directly (name, phone) or by combining fields (pincode + birth date + gender).
  • Data minimisation: collect and keep only what the model really needs.
  • Consent: people should know and agree how their data is used.
  • Re-identification: matching "anonymous" rows back to real people using a few fields.

The obvious attempt: delete the names and call the data anonymous.

import numpy as np
import pandas as pd
rng = np.random.default_rng(6)
n = 10000                               # made-up "anonymised" loan data: names removed
df = pd.DataFrame({"pincode": rng.integers(110001, 110101, n),           # 100 areas
                   "birth_date": pd.to_datetime("1960-01-01")
                                 + pd.to_timedelta(rng.integers(0, 16000, n), unit="D"),
                   "gender": rng.choice(["F", "M"], n),
                   "defaulted": rng.random(n) < 0.1})
combo = df.groupby(["pincode", "birth_date", "gender"]).size()
print(f"people: {n}   unique (pincode, birth date, gender): {(combo == 1).sum()}")
print(f"share who can be picked out exactly: {(combo == 1).sum() / n:.1%}")
df["decade"] = df.birth_date.dt.year // 10 * 10                    # fix: coarsen the details
df["area"] = df.pincode // 10                                      # 10 pincodes per area
combo2 = df.groupby(["area", "decade", "gender"]).size()
print(f"area + decade + gender: people alone {(combo2 == 1).sum()},"
      f" smallest group {combo2.min()}")
people: 10000   unique (pincode, birth date, gender): 9950
share who can be picked out exactly: 99.5%
area + decade + gender: people alone 0, smallest group 3

99.5% of people are the only one with their (pincode, birth date, gender), so anyone who knows a neighbour's pincode and birthday learns whether they defaulted. Coarsening (birth decade, a wider area) leaves nobody alone; the smallest group has 3 people. Real systems go further, e.g. adding carefully calibrated noise to results (differential privacy), but the lesson is: removing names is not anonymisation.

Common mistakes

Mistake What you see Why Fix
Dropping the gender column disparate impact 0.70: still biased proxy features measure per group, find proxies
Trusting historical labels the model copies past bias historical bias audit labels, reweigh
Checking only overall accuracy TPR 0.66 vs 0.54 hidden averages hide groups metrics per group
Demanding every fairness at once impossible to satisfy definitions conflict choose one that fits the harm
ThresholdOptimizer.predict(X) TypeError: ThresholdOptimizer.predict() missing 1 required keyword-only argument: 'sensitive_features' group thresholds need the group pass sensitive_features
"Anonymous" = names removed 99.5% re-identifiable field combinations minimise, coarsen, consent

Mini project: a fairness audit

For the hiring model: (1) find all proxies (each feature → gender, accuracy above 0.6 is a flag), (2) report pick rate, TPR, FPR and disparate impact per group before and after each mitigation, (3) choose one mitigation and justify it in two sentences, (4) write a one-page model card and a short datasheet.

Practice

1. Pick rates: group A 0.50, group B 0.35. Disparate impact? Does it pass the four-fifths rule?

Solution

0.35 / 0.50 = 0.70 < 0.80: it fails (evidence of adverse impact under the rule).

2. Two groups have equal pick rates but TPR 0.9 vs 0.6. Which definitions hold?

Solution

Demographic parity holds; equal opportunity fails (and therefore equalised odds fails too).

3. Compute the reweighing weight for "hired women" if 50% are women, 25% are hired, and 8% are hired women.

Solution

0.5 × 0.25 / 0.08 = 1.5625: each hired woman counts about 1.56 times.

4. Name one proxy for religion and one for age in Indian data.

Solution

Religion: first name or surname, pincode or locality. Age: year of graduation, years of experience, a phone model or an email domain popular with one generation.

Quick quiz

A skin-disease model trained on photos from one city hospital works badly for patients with darker skin tones. Main source of bias? Sampling bias: those patients were rare or missing in the training data.

Interview questions

  1. Why doesn't removing a protected attribute make a model fair?
  2. Define demographic parity, equal opportunity and equalised odds. When would you choose each?
  3. What is the disparate impact ratio and the four-fifths rule?
  4. Name three sources of bias with an example of each.
  5. Compare pre-, in- and post-processing mitigation, with one technique each.
  6. What goes into a model card? A datasheet?
  7. Why is removing names not enough to anonymise a dataset?

Glossary

Term Meaning, with an example
Bias (in ML fairness) A model systematically worse or harsher for one group: women shortlisted 0.22 vs men 0.31.
Protected attribute A trait that must not decide outcomes: gender, religion, caste, age.
Historical bias Labels copy past unfairness: "hired" decided by biased managers.
Sampling bias Some groups missing or rare in the data: photos from one hospital.
Measurement bias A feature measured worse for a group: a slow stopwatch at one ground.
Proxy feature An innocent-looking feature that reveals a protected one: career gap → gender (0.75).
Fairness through unawareness Dropping the protected column; fails when proxies exist.
Pick rate (selection rate) Share of a group that gets a "yes": 0.22 for women.
Demographic parity Equal pick rates across groups.
Equal opportunity Equal TPR: qualified people picked equally often (0.66 vs 0.54 fails).
Equalised odds Equal TPR and equal FPR across groups.
Disparate impact ratio Group pick rate ÷ highest group's pick rate: 0.70.
Four-fifths rule US guideline: a ratio below 0.80 is generally evidence of adverse impact.
Base rate How often the label is positive in a group.
Fairness-accuracy trade-off Fairer models may lose some accuracy on (possibly biased) labels: 0.812 → 0.807.
Pre-processing Fix the data before training: reweighing.
Reweighing Weights P(group)·P(label)/P(group, label) so rare pairs count more.
In-processing A fairness constraint inside training: ExponentiatedGradient.
Post-processing Adjust decisions after training: per-group thresholds (ThresholdOptimizer).
fairlearn Open-source Python library to measure and reduce unfairness.
Model card Short document with a model's intended use, per-group results and limits.
Datasheet for datasets A dataset's motivation, composition, collection and recommended uses.
Personal data Anything that identifies a person, directly or by combining fields.
Data minimisation Keep only the data the model really needs.
Consent People know and agree how their data is used.
Re-identification Matching "anonymous" rows to people: 99.5% unique by pincode + birth date + gender.
Differential privacy Adding carefully calibrated noise so results don't reveal any one person.

Summary

  • Models trained on past decisions inherit historical, sampling and measurement bias.
  • Removing the protected column fails because of proxies; measure fairness per group.
  • Demographic parity, equal opportunity, equalised odds and disparate impact measure different things and can conflict.
  • Reduce bias before (reweighing), during (constraints) or after (thresholds) training, and watch the trade-off.
  • Document with model cards and datasheets; protect privacy beyond deleting names.

Next episode: Interview prep 1: ML theory questions.