Finale · The Reasoners We Build
Part 41 of 42Fair Machines
algorithmic fairness, privacy, explanation, responsibility
Can a machine that decides about people be fair, and fair by whose measure?
The finale's first part opens with the COMPAS dispute of 2016: ProPublica found unequal error rates between Black and white defendants, Northpointe answered that the score was equally calibrated, and both had their numbers right. The three families of criteria are stated as independence, separation and sufficiency, and the Reasoner builds two populations with base rates of 30% and 50% and a perfectly calibrated score: at a threshold of 0.5 the false-positive rates are about 10% and 30%. The part turns on the impossibility. Chouldechova's identity is derived from the confusion table, Kleinberg, Mullainathan and Raghavan's theorem is proved in four lines and checked on the population, and a Price List sets out what each escape costs: the Wall's forty-first brick. Group thresholds are then searched and four policies entered in a ledger of errors. The middle chapters ask which fairness is owed, what individual and counterfactual fairness add, and what makes discrimination wrong, with fairness through unawareness tested and failing. Differential privacy is built from the Laplace mechanism, randomized response, composition and a reconstruction attack, and set against contextual integrity. It ends with Shapley and counterfactual explanations for a toy credit model, and with opacity and the responsibility gap.
What you need. Fractions and conditional probability at school level. The causal models of Part 17 and the Shapley value of Part 34 are recalled where they are used.
- The calculation
- fairness criteria, differential privacy, Shapley
- The wall
- Kleinberg–Chouldechova
- Built toy
- fairness auditor; DP mechanisms
What you will be able to do
Introductory
- Compute a false-positive rate, a false-negative rate and a precision from a confusion table, and say which of them each side of the COMPAS dispute compared.
- State independence, separation and sufficiency in words and give a decision rule that meets one and breaks another.
Advanced
- Derive Chouldechova's identity and prove the Kleinberg-Mullainathan-Raghavan theorem for a calibrated score.
- Calibrate Laplace noise to a query's sensitivity and add up the privacy loss of k queries.
- Compute exact Shapley values for a small model and check that they sum to the prediction's distance from the baseline.
Research
- State counterfactual fairness on a structural causal model, and set out the objection that a causal effect of race is not well defined and the path-specific reply.
- Explain why auditing every intersection of groups is hard, statistically and computationally.
Applied
- Audit a deployed score: report calibration, error rates and selection rates by group, and the cost in errors of each threshold policy.
- Write the fairness and privacy parts of a model card, naming the criterion chosen and what was given up for it.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Introductory 21 min · Advanced 48 min · Research 51 min · Applied 33 min.
- 0Can a machine be fair?Introductory2 min
- 1Machine biasIntroductory5 min
- 2Three kinds of fairnessIntroductory4 min
- 3The impossibilityAdvanced5 min
- 4Moving the thresholdsApplied3 min
- 5Which fairness?Introductory4 min
- 6Individuals and counterfactualsResearch3 min
- 7What makes discrimination wrong?Introductory4 min
- 8Differential privacyAdvanced5 min
- 9What privacy isAdvanced4 min
- 10ExplanationsApplied5 min
- 11Opacity and responsibilityApplied4 min
- Recap, problems, and where this comes backAll tracks2 min
Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · Build the film.
Lecture
The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film.
Can a machine be fair?Introductory2 min
This is the first of two final parts about the reasoners we build. Part 40 ended with machines that judge beauty. Machines now judge people: who gets bail, a loan, a job interview or extra medical care. In 2016 a newsroom's investigation began by claiming that software used across the country to predict future criminals was biased against Black defendants. The company replied that its software was fair. This part shows that both were right, proves why, and asks what fairness, privacy and explanation require of machines that decide.
Four questions run through the part. Fairness: which of several incompatible kinds of fairness should a prediction have? Discrimination: when is treating groups differently wrong, and why? Privacy: can data be useful without exposing the people in it? And explanation: what are we owed when a machine judges us, and who answers for its mistakes? The answer to the first, an impossibility theorem, is this part's brick in the Wall.
The plan. The COMPAS controversy, with both sides' numbers. Three criteria of fairness, and a threshold sweeping across two populations built by the Reasoner. Chouldechova's identity, proved on screen and checked, and Kleinberg, Mullainathan and Raghavan's theorem: this part's brick in the Wall. Thresholds for each group, and the cost of fairness. Hedden's coins, and fairness as political philosophy. Individual and counterfactual fairness, on a causal model, and the ethics of discrimination. Differential privacy: the Laplace mechanism, randomized response, and an attack that rebuilds a database. And explanations, opacity, and who is responsible when a machine errs.
What it establishes: the COMPAS question; four questions; the plan.
1Machine biasIntroductory5 min
In May 2016 the newsroom ProPublica published an analysis of COMPAS, a risk score used by courts in Broward County, Florida, and elsewhere, to predict whether defendants would reoffend. Among defendants who did not go on to reoffend, ProPublica reported, Black defendants had been labelled higher risk almost twice as often as white defendants: forty five percent against twenty three. Among those who did reoffend, white defendants had been labelled lower risk almost twice as often: forty eight percent against twenty eight. The company that made the score, then called Northpointe, replied that among defendants labelled higher risk, the share who reoffended was nearly the same in both groups, sixty three and fifty nine percent: the score meant the same thing whatever one's race. Both analyses were arithmetically correct. They measured different kinds of fairness, and this part shows why both cannot hold at once.
The case spread beyond journalism. In State versus Loomis, of 2016, Wisconsin's supreme court allowed COMPAS scores to be used at sentencing, provided judges were warned in writing about their limits. Julia Dressel and Hany Farid reported in 2018 that untrained people recruited online predicted reoffending about as accurately as COMPAS, sixty seven percent against sixty five. And a simple regression on just two features, age and the number of prior convictions, did as well. The deeper question is not only whether such a tool is accurate, but how its errors are distributed, and on whom they fall.
Scoring people for risk is almost a century old. In 1928 the sociologist Ernest Burgess studied three thousand men paroled in Illinois. He scored twenty-one factors, one point for each favourable one, and found that the more points a man had, the likelier he was to succeed on parole. Illinois began using the score in the nineteen thirties. In 1954 the psychologist Paul Meehl reviewed studies comparing clinical judgment with simple statistical formulas, and found the formulas matched or beat the experts. Half a century later, a meta-analysis of one hundred and thirty-six studies by William Grove and colleagues found mechanical prediction as good or better in the great majority. Bernard Harcourt's Against Prediction, in 2007, argued the other side: if a group is policed more because it is predicted to offend more, its members are caught more, its share of the records rises, and the prediction ratchets upward. The accuracy of a tool and its justice were separate questions long before COMPAS.
Where do these tools actually decide things? Often before any trial. Most people held in American jails have not been convicted of anything: they are waiting for their cases to be heard, often because they cannot pay bail. In 2017 New Jersey largely replaced cash bail with a risk assessment and conditions of release, and its pretrial jail population fell sharply. In 2020 California's voters went the other way. They rejected Proposition twenty-five, which would have replaced cash bail with risk assessment, after a campaign in which some civil-rights groups opposed the tools as biased. The philosophical point is the baseline. The alternative to an algorithm is not perfect justice; it is a judge's hunch, a fixed schedule of bail amounts, or release for those who can pay. Whether a tool is fair depends on what it replaces as well as on its error rates.
The same questions arise wherever models allocate. Lending models decide who can borrow, and at what rate. Amazon, as Reuters reported in 2018, scrapped an experimental résumé screener after it learned to penalize résumés containing the word women's. Ziad Obermeyer and colleagues showed in 2019 that a widely used health algorithm, which predicted future costs as a proxy for medical need, referred Black patients for extra care far less often than equally sick white patients. And Joy Buolamwini and Timnit Gebru found in 2018 that commercial face analysis systems erred far more often on darker-skinned women than on lighter-skinned men.
What it establishes: ProPublica; Northpointe; Loomis; Dressel and Farid; Obermeyer et al.; Buolamwini and Gebru; Burgess; Meehl; Grove et al.; Harcourt; pretrial reform.
2Three kinds of fairnessIntroductory4 min
Each side of the dispute was using a precise criterion, and they can be stated as conditional independence, following Solon Barocas, Moritz Hardt and Arvind Narayanan. Write A for the group, Y for the outcome and R for the prediction. Use the same R throughout; for a binary decision, take R to be Y hat. Independence: the distribution of predictions is the same across groups. For binary decisions, this is demographic parity. Separation: predictions are independent of group given the outcome. For binary decisions, this is equal false-positive and false-negative rates, the comparison ProPublica made. Sufficiency: the outcome is independent of group given the prediction. Calibration is a common way to achieve this for probability scores. Each criterion is a different answer to the question what fairness asks of a prediction.
How do the three criteria relate? Apply them to the same prediction R. For binary outcomes with different, nondegenerate base rates, p A and p B, the cases differ. Independence and sufficiency would force equal base rates, so they cannot coexist here. Independence and separation together force the prediction to carry no information about the outcome. An uninformative prediction is an exception to the usual conflict. Separation and sufficiency force the outcome to be perfectly recoverable from the prediction: zero conditional entropy. A calibrated probability score would have to predict perfectly. So perfect prediction can satisfy separation and sufficiency, while an uninformative prediction can satisfy independence and separation. Also distinguish a score from its thresholded or post-processed decision: a calibrated score can coexist with an adjusted decision, because they are different predictions. Chapter three makes the score-level balance theorem precise.
The Reasoner builds its own population to see what is going on. Two groups. In group A, thirty percent go on to reoffend; in group B, fifty percent. Each person's score is their true risk, so the score is perfectly calibrated in both groups: among everyone scored point six, sixty percent reoffend. Above each axis are those who reoffended; below, those who did not. A single threshold labels everyone above it high risk. At point five, the table shows each group's false-positive rate, its false-negative rate, and its precision, the share of those labelled high risk who reoffend. Because group B's scores sit higher, more of its innocent members cross the line: its false-positive rate is three times A's. Move the threshold down, and both groups' false positives rise; move it up, and false negatives rise. At no threshold do the two groups' error rates match, though the score itself treats everyone alike.
All three criteria take the outcome Y for granted. But what is Y? In criminal justice it is usually a new arrest or a reconviction, not a new offence. An arrest records where the police were looking as well as what people did. Kristian Lum and William Isaac ran a predictive-policing algorithm on Oakland's records of drug arrests. It would have sent patrols mostly to Black neighbourhoods, though public-health surveys put drug use about evenly across the city. Danielle Ensign and colleagues showed how this can run away: patrol where crime was recorded, record more crime where you patrol, and the data confirm the patrols. Abigail Jacobs and Hanna Wallach drew the general lesson. A fairness criterion is a condition on measured variables, and every one of them inherits the gap between the thing we care about, like offending or need, and the thing we managed to measure. A perfectly calibrated score for arrests can be a biased score for crime.
What it establishes: Barocas, Hardt and Narayanan; Lum and Isaac; Ensign et al.; Jacobs and Wallach.; Computed on screen: a threshold swept across two populations
3The impossibilityAdvanced5 min
Alexandra Chouldechova showed in 2017 why the two analyses had to disagree. It takes three lines of algebra. Start from the definitions: the base rate p, the precision, the false-negative rate and the false-positive rate, all ratios of the four cells of the confusion table. Rewrite the false positives in terms of the true positives and the precision, the true positives in terms of the base rate and the false-negative rate, and the people who do not reoffend as one minus p times N. Divide, and the false-positive rate equals p over one minus p, times one minus the precision over the precision, times one minus the false-negative rate. The Reasoner checks it on its population: the identity reproduces each group's false-positive rate. For base rates strictly between zero and one, equal precision strictly between zero and one, and a common false-negative rate below one, different base rates force different false-positive rates. Perfect precision is an exception: there are no false positives, even if some positives are missed.
Jon Kleinberg, Sendhil Mullainathan and Manish Raghavan proved the same impossibility for scores, in 2016. Calibration: in each group, a score of s means a share s reoffend. On the Reasoner's population, both groups' dots lie on the diagonal. Balance for the positive class: those who do reoffend should get the same average score in each group. Here they get point four four in group A and point six in group B. Balance for the negative class: those who do not reoffend should get the same average score. Here, point two four against point four. The theorem: all three conditions can hold together only if the groups have equal base rates, or the prediction is perfect. Neither is true of any real risk score.
Why must this happen? The proof takes four lines. In group a, write p for the base rate, x for the average score of those who reoffend, and y for the average score of those who do not. Calibration means the average score in the group equals its base rate. But the average score is a mixture: a share p of the group averages x, and the rest averages y. So p x plus one minus p times y equals p. Rearranging, the odds of the base rate, p over one minus p, equal y over one minus x. Now balance says x and y are the same in both groups. Then the right-hand sides are equal, so the odds are equal, so the base rates are equal. The Reasoner checks its population. In group A, the odds are point four two, and y over one minus x is point four three; in group B, one point zero two against point nine nine, equal up to sampling noise. The identity holds in each group, so the two sides cannot both match across groups. The only escape is x equal to one and y equal to zero, which is perfect prediction.
Four claims cannot all be true. The score is calibrated in each group; its average is equal across groups within each outcome class, x A equals x B and y A equals y B; the base rates differ; and prediction is imperfect. Kleinberg's theorem forces one to go. Keeping calibrated scores, as Northpointe did, can leave these class averages unequal. For a binary decision, the two class averages are the true-positive and false-positive rates. Hardt, Price and Srebro's post-processing equalizes those rates; the resulting binary output loses calibration in this case. This differs from retaining a calibrated score alongside a separate adjusted decision. Some propose changing the target: predicting an outcome less shaped by biased measurement, or changing the conditions that make base rates differ. Perfect prediction is never on offer.
This is the forty first brick in the Wall. The dream was a classifier fair by every measure: calibrated, with equal class-average scores, and treating each group alike. Kleinberg, Mullainathan and Raghavan proved that when base rates differ and prediction is imperfect, calibration and both class balances cannot all hold. Chouldechova's identity shows a related trade-off for classification. What it forces is a choice of which fairness to have, and that choice is moral, not technical.
What it establishes: Chouldechova; Kleinberg, Mullainathan and Raghavan; the Wall's forty-first brick.; Computed on screen: the identity checked; calibration and balance; the four-line proof; the Price List
4Moving the thresholdsApplied3 min
If one threshold cannot satisfy both criteria, try one threshold for each group. Choose them so that both groups have a false-positive rate of twenty percent: the thresholds are point three nine for A and point five eight for B. False negatives come out nearly equal too, but precision does not: point five five in A, point seven four in B. A high-risk label now means less for group A. Choose them instead for equal precision of point seven: then group A's false-positive rate is four percent and group B's thirty. And thresholds that depend on group raise their own problem: treating people differently because of their group is disparate treatment, which anti-discrimination law forbids in many settings.
Each choice has a measurable cost. Sam Corbett-Davies and colleagues showed in 2017 that if the aim is to minimize crime and detention together, the best rule is a single threshold on a calibrated score. So equalizing error rates means detaining some lower-risk people and releasing some higher-risk ones, and that harms someone too. Hardt, Price and Srebro defined equal opportunity as equal true-positive rates, achieved by post-processing, with randomized thresholds where needed. Every fairness constraint has a price, in accuracy or in someone's outcome, and someone must choose which price to pay.
The Reasoner keeps a ledger of what each policy costs, for its forty thousand people. One threshold at point five, the same for everyone, is the most accurate: seventy-two point one percent. It labels four thousand three hundred and seventy-five innocent people high risk, and misses six thousand seven hundred and eighty-five who reoffend. On a calibrated score, no other policy makes fewer errors. Equal false-positive rates cost five hundred and eighty-five extra errors. Equal precision costs only one hundred and sixty-eight, but it misses nine hundred and eighty more people who go on to reoffend. Equal selection rates, demographic parity, cost the most, nine hundred and thirty-two errors, and they reverse the original gap: now group A's false-positive rate is nineteen percent and group B's fourteen. The columns are burdens on different people: innocent people detained, victims of crimes that were not prevented. No policy is free, and choosing among them is choosing who bears which cost.
Fairness can also be built in earlier. Constraints can be added during training, as in methods by Muhammad Bilal Zafar and colleagues in 2017 and Alekh Agarwal and colleagues in 2018. Many disparities come from what is measured: arrests are not offences, and health costs are not health needs, as the Obermeyer study found. Úrsula Hébert-Johnson and colleagues defined multicalibration in 2018: calibration on every identifiable subgroup at once. But no algorithm escapes the identity; each only chooses where the errors fall.
What it establishes: Corbett-Davies et al.; Hardt, Price and Srebro; Zafar et al.; Agarwal et al.; Hébert-Johnson et al.; Computed on screen: group thresholds; the ledger of four policies
5Which fairness?Introductory4 min
Which criterion is right? Brian Hedden argued in 2021 with a thought experiment. People in two rooms hold coins of different biases, and a predictor announces each coin's true bias before it is tossed. Nothing could be fairer, yet if the coins in one room are biased differently from those in the other, the predictor's error rates differ between the rooms. So, Hedden concluded, equal error rates cannot be necessary for fairness; only calibration-like criteria are. The Reasoner's population was exactly this case: scores equal to true risks, and false-positive rates of ten and thirty one percent.
Others reply that error rates still matter. A false positive in criminal justice can mean detention; who bears the mistakes is a question of justice, not of accuracy. Robert Long argued in 2021 that equal false-positive rates are not required by fairness, because they compare people who differ in risk. Deborah Hellman's Measuring Algorithmic Fairness, of 2020, defended the significance of error-rate balance, because it tracks the burdens a system imposes on each group. And if the base rates themselves reflect past injustice, a score calibrated to them carries that injustice forward.
Sorelle Friedler, Carlos Scheidegger and Suresh Venkatasubramanian located the disagreement in a single assumption. Distinguish the construct space, the qualities we actually care about, such as the risk of causing harm, or merit, from the observed space, the features we can measure. We never see the construct directly. One worldview, what you see is what you get, assumes the observed features measure the construct faithfully. Then a calibrated score is the truth about each person, and treating similar scores alike is all fairness asks. The opposite worldview, we're all equal, assumes the groups do not differ in the construct, so any difference in the observed scores is bias in measurement, and fairness demands parity between groups. Each worldview makes one family of criteria correct, and the choice between them is an assumption about the relation between the observed and the unobserved, which the observed data alone cannot test. Hedden and Hellman were arguing, in part, about which world we are in.
The debate is political philosophy in new dress. Reuben Binns argued in 2018 that each fairness metric encodes a theory of justice. Equal opportunity, as Hardt and colleagues named their criterion, echoes Rawls's fair equality of opportunity and Roemer's compensation for circumstances from Part 38. If belonging to a group with a high base rate is a matter of brute luck, the luck egalitarian will favour equal error rates. No metric is neutral: choosing one is choosing a conception of justice.
The choice among criteria is also a legal one. In 2023, in Students for Fair Admissions against Harvard, the United States Supreme Court held that race-conscious admissions at Harvard and at the University of North Carolina were unlawful. Group-specific thresholds, like the ones in chapter four, use the group explicitly, and face the same objection: they treat two people with the same score differently because of their group. This puts the law in tension with itself. Disparate-impact doctrine looks at outcomes by group and asks for unequal effects to be justified, while disparate-treatment doctrine forbids deciding by group at all. A model can satisfy one by violating the other. Daniel Ho and Alice Xiang argued that many fairness methods need awareness of the group to work, and that the law must find room for them, perhaps in the doctrines that once allowed government contractors to remedy their own past discrimination. The mathematics of chapter three meets the constitution here.
What it establishes: Hedden; Long; Hellman; Binns; Rawls; Roemer; SFFA v. Harvard; Ho and Xiang; Friedler, Scheidegger and Venkatasubramanian.
6Individuals and counterfactualsResearch3 min
Group criteria compare averages. Cynthia Dwork and colleagues proposed in 2012 a criterion about individuals. Similar individuals should be treated similarly. Formally, the distance between the decisions for x and y should be at most the distance between x and y themselves, in a metric chosen for the task: a Lipschitz condition. The catch is that everything rests on that metric: deciding who is relevantly similar to whom is the moral question itself, now hidden inside a function. And individual fairness can coexist with large disparities between groups.
Matt Kusner, Joshua Loftus, Chris Russell and Ricardo Silva proposed in 2017 a criterion that uses the causal models of Part 17. The Reasoner writes one. Each person has an ability U. Their test score X is the ability, minus one point if they belong to group one, whose schools were worse, plus a little noise. The outcome to be predicted depends on ability alone. A predictor that uses the test score directly is accurate on average, but ask the counterfactual question: what would it have predicted for this very person, with the same ability and the same luck, had they belonged to the other group? The answer changes by a full point. A predictor that first recovers ability from the model, adding back the point the group lost, predicts the same in both worlds. It is counterfactually fair. The price is that we must trust the causal model, and know how group membership shaped each measurement.
The counterfactual approach has critics. Issa Kohler-Hausmann argued in 2019 that race is not a variable that can be toggled while everything else is held fixed; it is a social category constituted by many of the very things a model would hold fixed. Path-specific approaches, by Silvia Chiappa and by Razieh Nabi and Ilya Shpitser, allow some causal paths from group membership to the decision and forbid others. But which paths are legitimate, through qualifications or through neighbourhood, is again a moral judgment, not a statistical one.
Between the individual and the group lies a middle ground: groups within groups. In 1989 the legal scholar Kimberlé Crenshaw showed how courts had dismissed claims by Black women because the employer hired Black men and hired white women, so neither race nor sex discrimination could be shown. She called the blind spot intersectionality. Michael Kearns, Seth Neel, Aaron Roth and Steven Wu found the same blind spot in machine learning, and called it fairness gerrymandering: a classifier can be fair to each race and to each sex while being unfair to their intersections. Their fix is to audit over a rich family of subgroups at once, the same move multicalibration makes for scores. The price is statistical. The finer the subgroups, the fewer people in each, and the noisier every estimate of their error rates; fairness to the smallest groups is the hardest to certify, though they may need it most.
What it establishes: Dwork et al.; Kusner et al.; Kohler-Hausmann; Chiappa; Nabi and Shpitser; Crenshaw; Kearns et al.; Computed on screen: counterfactual predictions on a causal model
7What makes discrimination wrong?Introductory4 min
The law of discrimination supplies two concepts. Disparate treatment is deciding differently because of a protected characteristic such as race or sex. Disparate impact, from the Supreme Court's Griggs versus Duke Power of 1971, holds that a neutral rule with unequal effects, like a diploma requirement, must be justified by business necessity. Economists Edmund Phelps and Kenneth Arrow described statistical discrimination in the early 1970s: using group averages as evidence about individuals, even without any animus. Machine learning makes the last point acute: removing a protected variable does not remove the information, because zip codes and purchase histories stand in for it.
A common first answer is to leave the group out of the model: fairness through unawareness. The Reasoner tests it. Its model never sees the group. It sees only a neighbourhood, and the neighbourhood matches the group four times in five, as residential segregation often does. In one neighbourhood, thirty-four percent go on to reoffend; in the other, forty-six. The model labels the riskier neighbourhood high risk. It labels twenty percent of group A and eighty percent of group B, though the groups' actual rates are twenty-nine and fifty percent. Removing the variable did not remove the group; with only a coarse proxy to go on, the model leaned on it harder, and widened the gap. To check a model for discrimination, you must collect exactly the variable that unawareness throws away.
Philosophers disagree about why discrimination is wrong. On harm-based views, such as Kasper Lippert-Rasmussen's, it wrongs people by making their lives worse, especially those already disadvantaged. Deborah Hellman's When Is Discrimination Wrong?, of 2008, answers: when it demeans, expressing that some people count for less. Benjamin Eidelson's Discrimination and Disrespect, of 2015, locates the wrong in failing to treat people as individuals, the authors of their own lives. For algorithms the views come apart: a model has no attitudes, so harm-based and practice-based accounts apply directly, while the expressive account needs to ask what a system's use means in its society.
Audits show what can be done. Gender Shades, by Buolamwini and Gebru in 2018, found error rates of up to thirty five percent for darker-skinned women and under one percent for lighter-skinned men, and the vendors' systems improved after publication. In the health study, replacing the cost target with a direct measure of illness would raise the share of Black patients flagged for extra care from about eighteen percent to forty seven. New York City's Local Law 144, in force since 2023, requires bias audits of automated hiring tools. And American fair-lending law applies disparate impact to credit models.
Insurance shows the same conflict with money attached. Actuarial fairness says each person should pay a premium matching their own expected cost. That is calibration, priced: a young man pays more for car insurance because young men crash more. In 2011, in the Test-Achats case, the European Court of Justice ruled that sex may not be used to set insurance premiums, from December 2012, even where it predicts. In the United States, the Genetic Information Nondiscrimination Act of 2008 bars genetic information from health insurance and employment decisions, though not from life insurance. Behind these laws is a different idea of what insurance is for. Insurance pools risk on purpose, so that people do not bear alone the costs of risks they did not choose. That is the luck egalitarian's thought from Part 38: a predictive variable that tracks brute luck may be one that fairness forbids us to price.
What it establishes: Griggs; Phelps; Arrow; Lippert-Rasmussen; Hellman; Eidelson; Gender Shades; Local Law 144; Test-Achats; GINA.; Computed on screen: fairness through unawareness, tested
8Differential privacyAdvanced5 min
Privacy first. The old method, removing names, fails. Latanya Sweeney showed that zip code, birth date and sex alone identify most Americans, about eighty seven percent in her 2000 study, and she found the governor of Massachusetts in supposedly anonymous hospital records. In 2008 Arvind Narayanan and Vitaly Shmatikov re-identified users of the Netflix Prize data from a handful of ratings and their dates. When AOL released search logs under numbers in 2006, reporters found user four four one seven seven four nine within days. Removing names does not anonymize: any rich enough record is a fingerprint.
Differential privacy, defined by Cynthia Dwork, Frank McSherry, Kobbi Nissim and Adam Smith in 2006, makes privacy a precise promise. To release a count from a database, add random noise drawn from a Laplace distribution whose width is one over epsilon. Now compare two databases that differ in one person, whose true counts differ by one. The two output distributions, here for epsilon equal to one, are shifted copies of each other. At every possible output, the probability densities differ by a factor of at most e to the epsilon; the Reasoner checks that the largest ratio is exactly that. This also bounds the probability ratio for any output range. So whatever anyone learns from the output, they learn almost the same whether or not you are in the data. Smaller epsilon means wider noise: more privacy, and less accuracy. The typical error is one over epsilon: ten for epsilon a tenth, half for epsilon two.
An older trick shows the idea at its simplest. Stanley Warner proposed in 1965 a way to ask embarrassing survey questions. Each respondent flips a coin: on heads, they answer truthfully; on tails, they flip again and say yes on heads, whatever the truth. The Reasoner simulates two thousand respondents, thirty percent of whom have the embarrassing trait; about forty two percent say yes. Since a yes comes with probability half the true share plus a quarter, the share can be estimated, here as point three four, give or take two hundredths, while every single answer is deniable: differentially private with epsilon the natural log of three. But privacy loss adds up. A hundred queries each with epsilon a tenth lose up to ten in total; a smarter accounting, advanced composition, gives about six. Privacy is a budget that every released statistic spends.
Differential privacy comes in two architectures. In the central model, a trusted curator holds the raw data and adds noise once, to the answer; a count is then off by about one over epsilon, however many people are counted. In the local model, which is randomized response, each person adds noise before their data leave their device. No one need be trusted, but the noise adds up: a count over n people is off by about the square root of n over epsilon. Machine learning uses the central model. Martín Abadi and colleagues showed how to train a deep network privately: clip each training example's gradient so no one example can move the model much, add Gaussian noise, and keep an account of the privacy spent, using composition. The price falls unevenly. Eugene Bagdasaryan and colleagues found that private training costs the most accuracy on small and unusual groups, whose examples are exactly the ones clipping and noise suppress. Privacy and fairness are not independent goals.
Why accept noise at all? Because without it, aggregates leak individuals. Irit Dinur and Kobbi Nissim showed in 2003 that answering too many questions too accurately lets an attacker rebuild the data. The Reasoner hides sixty four secret bits, one per person, and releases two hundred and fifty six sums over random subsets of people, each with some noise. An attacker solves for the bits by least squares and rounds. With noise up to two, every bit comes back. Only when the noise approaches the square root of the number of people, eight here, does the attack start to fail. This is the theorem that convinced the United States Census Bureau to adopt differential privacy for the 2020 census.
What it establishes: Sweeney; Narayanan and Shmatikov; Dwork, McSherry, Nissim and Smith; Warner; Dinur and Nissim; Abadi et al.; Bagdasaryan et al.; Computed on screen: the Laplace mechanism; randomized response; composition; reconstruction
9What privacy isAdvanced4 min
What is privacy? Differential privacy answers one precise question. Helen Nissenbaum's Privacy in Context, of 2010, answers a broader one. Information flows, she argues, carry the norms of their contexts: medical information flows to doctors, gossip among friends, purchases to sellers. Privacy is violated when a flow breaks those norms, even if the information was public. Differential privacy does not stop inferences from patterns in other people's data: a retailer's model can infer that a customer is likely pregnant from what similar customers bought. What it guarantees is about you, not about what can be learned about people like you.
Differential privacy is now policy. The 2020 United States census was the first major release protected by it, with a total privacy budget set by officials. Small-area counts became noisier, demographers and some states objected, and the trade-off between accuracy and privacy became a public argument. Google's RAPPOR, from 2014, and Apple's on-device systems use randomized response at scale. The choice of epsilon is a value judgment, not a technical one: how much accuracy to give up for how much protection.
Why does privacy matter at all? Samuel Warren and Louis Brandeis, in 1890, called it the right to be let alone. James Rachels argued in 1975 that privacy lets us maintain different kinds of relationship with different people, which would be impossible if everyone knew everything. Daniel Solove's Understanding Privacy, of 2008, treated it as a family of problems: surveillance, aggregation, exclusion and exposure. And Shoshana Zuboff's The Age of Surveillance Capitalism, of 2019, emphasized power: information about behaviour as leverage over behaviour.
Large models make privacy concrete again. In 2021 Nicholas Carlini and colleagues showed that a language model, GPT-2, could be prompted to emit text it had memorized from its training data, verbatim, including people's names, phone numbers and addresses. Two years later, Carlini's group showed that image generators can regenerate some of their training images almost exactly. A model trained on personal data is, in part, a store of it. The law has a right that now applies to models. In the Google Spain case of 2014, Europe's highest court held that people can ask search engines to delist information about them, and the General Data Protection Regulation's Article seventeen gives a right to erasure. But erasing a person from a trained model is hard. Lucas Bourtoule and colleagues proposed training on separate shards of data, so that forgetting one person means retraining only one shard. Differential privacy offers the deeper answer: a model that never depended much on anyone has little to forget.
The usual legal answer to all this is consent: tell people what will happen to their data, and let them agree. Aleecia McDonald and Lorrie Cranor estimated in 2008 that reading every privacy policy an American meets online would take about two hundred hours a year. No one does it. Daniel Solove argued that the problem is deeper than time. Privacy self-management asks each person to judge uses of their data that no one can foresee, by aggregation with other data, years later. Contextual integrity explains why consent is not enough: a click on a box cannot make a flow appropriate when it breaks the norms of the context the data came from. Jack Balkin proposed another model, borrowed from the professions. Those who hold our data would be information fiduciaries, owing us duties of care and loyalty, as doctors and lawyers do. The burden then falls on those with the knowledge, not on the user with a checkbox.
What it establishes: Nissenbaum; the 2020 census; RAPPOR; Warren and Brandeis; Rachels; Solove; Zuboff; Carlini et al.; Google Spain; Bourtoule et al.; McDonald and Cranor; Balkin.
10ExplanationsApplied5 min
Explanation is the third demand on fair machines. Here is a toy credit model. The score adds income and credit history, subtracts debt, and adds a bonus when income and history are both high. An applicant scores point zero five, below the cutoff of point two, and is refused. Why? Shapley values, the fair division of Part 34 applied to features, average each feature's contribution over every order in which the features could be added. Income added point four five, history point two, and debt took away point six. They add up exactly to the score, which is what makes them attractive; Scott Lundberg and Su-In Lee's SHAP made them standard in 2017. A counterfactual explanation, in Sandra Wachter, Brent Mittelstadt and Chris Russell's sense, says instead what would have changed the decision: raising income by point three, or history by point three, or cutting debt by point three, would each have been enough. Debt was the largest factor, yet three different smallest changes exist, and the explanation is not unique.
The counterfactual explanation deserves a closer look, because it is the kind people can use. Sandra Wachter, Brent Mittelstadt and Chris Russell proposed it in 2017: tell the applicant the smallest change that would have flipped the decision, without opening the model. Berk Ustun, Alexander Spangher and Yang Liu pointed out that the smallest change may be useless. A change in age or in credit history cannot be made. Actionable recourse searches only over changes the person can actually make. Amir-Hossein Karimi and colleagues added causality: actions have effects. Taking a second job raises income, but may also change debt and hours, so recourse needs a causal model of the kind built in Part 17, not just a model of the classifier. Suresh Venkatasubramanian and Mark Alfano argued that recourse is a moral claim in its own right: in a world run by models, people should be able to change their standing by their own effort.
Do people have a right to an explanation? Europe's General Data Protection Regulation, in force since 2018, limits decisions made solely by automated means, and its preamble mentions obtaining an explanation. Sandra Wachter, Brent Mittelstadt and Luciano Floridi argued in 2017 that the regulation grants a right to be informed, not a right to an explanation of each decision. The European Union's AI Act, of 2024, requires transparency and human oversight for high-risk systems, and gives people a right to an explanation of individual decisions made with them. Explanations serve several purposes: to contest a decision, to know what to change, and to decide whether to trust the system at all.
Explanations have limits. Cynthia Rudin argued in 2019 that for high-stakes decisions we should stop explaining black boxes and use models that are interpretable to begin with. Dylan Slack and colleagues showed in 2020 that a deliberately biased model can be disguised so that popular explanation tools report only innocent features. Many models fit the data equally well while relying on different features, the Rashomon effect, so an explanation describes one model, not the world. And Tim Miller's review of 2019 found that people want contrastive explanations: why this outcome rather than that one.
Shapley values and counterfactuals explain a model from outside, by its inputs and outputs. A newer program tries to explain it from inside. Chris Olah and colleagues proposed reading a neural network like an organism under a microscope: find the features its neurons detect, and the circuits that connect them. Nelson Elhage and colleagues found a complication. Networks represent more features than they have neurons, overlapped in superposition, so single neurons rarely mean one thing. Adly Templeton and colleagues used sparse autoencoders to pull the overlapped features apart, and found millions of interpretable ones in a production language model, from famous people to code errors to deception. The hope is an explanation of how a model computes its answer, not just which inputs mattered: an explanation that could show a model was relying on a proxy for the group, or planning to mislead. Part 42 asks whether that is enough to trust it.
What it establishes: the GDPR; Wachter, Mittelstadt and Floridi; the EU AI Act; Lundberg and Lee; Wachter, Mittelstadt and Russell; Ustun et al.; Karimi et al.; Venkatasubramanian and Alfano; Rudin; Slack et al.; Miller; Olah et al.; Elhage et al.; Templeton et al.; Computed on screen: Shapley values; counterfactual explanations
11Opacity and responsibilityApplied4 min
Can we trust what we cannot understand? Jenna Burrell distinguished in 2016 three kinds of opacity: corporate secrecy, the public's technical illiteracy, and the sheer scale of the model itself. Juan Durán and Nico Formanek proposed computational reliabilism in 2018: trust a process with a verified track record, as we trust instruments we do not understand. Part 12 asked when we may rely on experts we cannot check; the question now is whether models are experts. The worry is that track records are measured on yesterday's data, and the world shifts.
When a machine errs, who is responsible? Andreas Matthias argued in 2004 that learning machines act in ways their makers could not predict, opening a gap between harm and blame. Dennis Thompson in 1980, and Helen Nissenbaum in 1996, described the problem of many hands: when many people each contribute a little, no one seems to blame. Part 32 found that responsibility needs control and knowledge, and in machine learning both are spread thin. Filippo Santoni de Sio and Giulio Mecacci replied in 2021 that we must design for meaningful human control and assign responsibility in advance, before anything goes wrong.
A common answer to responsibility gaps is to keep a human in the loop. Madeleine Clare Elish warned that the human can become a moral crumple zone. In a car, the crumple zone absorbs the force of a crash; in a complex automated system, blame collapses onto the nearest human operator, who had the least control over its design. In 2018 in Tempe, Arizona, a self-driving test car killed a pedestrian. The safety driver was charged; the company was not. And the human in the loop is not independent. Linda Skitka and colleagues documented automation bias: people follow automated advice, even when it is wrong and they have evidence it is wrong. Ben Green and Yiling Chen gave people pretrial risk scores in an experiment. The scores did not make their predictions much better, and people deviated from them differently for Black and for white defendants. A human in the loop can add a bias as well as remove one.
Institutions have begun to respond. Margaret Mitchell and colleagues proposed model cards in 2019: a short report on what a model is for and how it performs on each group. Timnit Gebru and colleagues proposed datasheets for datasets: where the data came from, who is in it, and what it should not be used for. Inioluwa Deborah Raji and Joy Buolamwini showed in 2019 that public external audits changed vendors' behaviour. And the AI Incident Database, begun in 2020, records failures as aviation records near-misses, so that others can learn from them.
Accountability is now being written into standards. The United States National Institute of Standards and Technology published its AI Risk Management Framework in 2023, organized around four functions: govern, map, measure and manage. The same year, ISO and the IEC published 42001, a management-system standard that an organization building or using AI can be certified against, as it can for quality or information security. Canada's Directive on Automated Decision-Making, from 2019, requires government departments to assess a system's impact before deploying it, with more review for higher impact. These are real gains: they make someone responsible for asking the questions of this part. But a process standard asks whether you checked, not whether the result is just. Which error rates to equalize, how much privacy to buy, which explanation is owed: the standards leave these to judgment, and that judgment is philosophy.
What it establishes: Burrell; Durán and Formanek; Matthias; Thompson; Nissenbaum; Santoni de Sio and Mecacci; Mitchell et al.; Gebru et al.; Raji and Buolamwini; Elish; Skitka et al.; Green and Chen; NIST; ISO/IEC 42001.
Recap, problems, and where this comes backAll tracks2 min
Let's gather what we built. The COMPAS dispute, in which both sides' numbers were right. Three criteria of fairness, and a single threshold that leaves error rates unequal. Chouldechova's identity and Kleinberg's balance, this part's brick in the Wall, and its Price List. Separate thresholds, which trade one equality for another. Hedden's coins and the philosophers' replies. Individual and counterfactual fairness. Differential privacy's guarantee checked, a survey that protects every answer, and a database rebuilt from accurate sums. Shapley values, counterfactual explanations that are not unique, and the gaps in responsibility.
The Reasoner has a new module, fairness. It builds populations and measures every group criterion, checks the impossibility, searches thresholds, reasons with a causal model, adds calibrated noise, attacks noisy data, and explains a model's decisions. And the Wall has its forty first brick.
Six problems, with full solutions in this part's notes. The identity from scratch; why perfect prediction escapes the theorem; a trivially fair but useless classifier; the privacy of a biased coin; adding up a privacy budget; and the Shapley values of a product. Pause here, and try them.
Where this comes back. Part 42, the finale, asks whose values a reasoner should have, of which fairness is one; what goes wrong when a system optimizes a measurable proxy, as the health algorithm optimized cost; and who is responsible for systems that act on their own. Next, Part 42: aligning reasoners.
The books and papers this part follows are on screen, and in the notes. Thanks for watching.
Where it goes next. Part 42 takes the same question from a classifier to an agent: what to specify, how values are learned from feedback, and whose values count. The trilemma is filed in Part 42's complete Wall with Arrow's and Sen's theorems, under aggregation.
Key results
The part's results in one place, for revision.
Try it
Lab 41 · A calibrated score that cannot be balanced, and a count that can be private
Draw two groups with base rates 30% and 50% and a perfectly calibrated score. Check Chouldechova's identity and Kleinberg's four-line identity in each group, try to equalize error rates or precision with group thresholds, then check randomized response, the reconstruction attack and the Shapley values' sum.
python -m videos.philosophy.labs 41
needs numpy, scipy, matplotlib · download lab41.py ·
source on GitHubone threshold at 0.5: false-positive rate A, B 0.097, 0.305 (film: about 0.10 and 0.30)
... precision A, B 0.633, 0.697
base-rate odds p/(1-p), A and B 0.42, 1.02 (film: 0.42, 1.02)
y/(1-x) from the class-average scores 0.43, 0.99 (film: 0.43, 0.99)
least FPR gap (B minus A) over 17 shared thresholds +0.003 (never zero)
group thresholds with equal FPR: precision A, B 0.552, 0.742
group thresholds with equal precision: FPR A, B 0.044, 0.298
randomized response, 20,000 people, true share 0.30 estimate 0.286 +/- 0.007 (eps = ln 3)
secret bits rebuilt from noisy sums: noise 1, 4, 16 100%, 91%, 72% (sqrt(n) = 8)
Shapley values at income, history, debt = 1.35, 0.69, 0.27 +0.633, +0.300, -0.135
The score treats everyone alike and is calibrated in both groups, yet with unequal base rates no threshold policy equalizes error rates and precision together: which gap to accept is a moral choice. Noise protects a count only when it is large compared with the square root of the data.
The code (100 lines; it asserts its own result)
"""Lab 41: audit a calibrated risk score in two groups, and see what noise does and does not protect."""
import math
import numpy as np
from videos.coursekit import labs
from explainer.philosophy.reasoner import fairness
TITLE = "A calibrated score that cannot be balanced, and a count that can be private"
GOAL = ("Draw two groups with base rates 30% and 50% and a perfectly calibrated score. Check Chouldechova's identity "
"and Kleinberg's four-line identity in each group, try to equalize error rates or precision with group "
"thresholds, then check randomized response, the reconstruction attack and the Shapley values' sum.")
TASKS = [
"Call fairness.population with means=(0.4, 0.4). Which of the gaps between the groups at threshold 0.5 "
"disappear, and which remain as sampling noise?",
"In fairness.reconstruction ask only n queries instead of 4n (edit m). How much noise is now enough to protect "
"the secret bits?",
"Change the randomized-response coin so that people answer truthfully with probability 3/4. Derive the new "
"estimator and epsilon, and compare the standard error.",
]
def run(seed=0):
rng = np.random.default_rng(seed)
lab = labs.Lab()
s = 2016 + seed
c = fairness.criteria(t=0.5, seed=s)
ra, rb = c["rates"]["A"], c["rates"]["B"]
lab.row("one threshold at 0.5: false-positive rate A, B", f"{ra['fpr']:.3f}, {rb['fpr']:.3f} (film: about 0.10 and 0.30)")
lab.row("... precision A, B", f"{ra['ppv']:.3f}, {rb['ppv']:.3f}")
for g in "AB":
r = c["rates"][g]
assert abs(c["identity_fpr"][g] - r["fpr"]) < 2e-3, "Chouldechova's identity reproduces the FPR"
assert abs(ra["fpr"] - 0.10) < 0.02 and abs(rb["fpr"] - 0.30) < 0.03 and rb["fpr"] > 2.5 * ra["fpr"]
odds, rhs = {}, {}
for g in "AB":
p, x, y = c["rates"][g]["base"], c["balance"][g]["pos"], c["balance"][g]["neg"]
odds[g], rhs[g] = p / (1 - p), y / (1 - x)
assert abs(odds[g] - rhs[g]) < 0.06 * odds[g], "calibration forces p/(1-p) = y/(1-x) in each group"
lab.row("base-rate odds p/(1-p), A and B", f"{odds['A']:.2f}, {odds['B']:.2f} (film: 0.42, 1.02)")
lab.row("y/(1-x) from the class-average scores", f"{rhs['A']:.2f}, {rhs['B']:.2f} (film: 0.43, 0.99)")
assert c["balance"]["B"]["pos"] - c["balance"]["A"]["pos"] > 0.1, "so the class averages cannot match"
assert c["balance"]["B"]["neg"] - c["balance"]["A"]["neg"] > 0.1
sw = fairness.sweep(seed=s)
gap = [b["fpr"] - a["fpr"] for a, b in zip(sw["rates"]["A"], sw["rates"]["B"])]
lab.row("least FPR gap (B minus A) over 17 shared thresholds", f"{min(gap):+.3f} (never zero)")
assert min(gap) > 0, "no shared threshold equalizes the false-positive rates"
gt = fairness.group_thresholds(seed=s)
eq_fpr, eq_ppv = gt["fpr"], gt["ppv"]
lab.row("group thresholds with equal FPR: precision A, B", f"{eq_fpr['A']['ppv']:.3f}, {eq_fpr['B']['ppv']:.3f}")
lab.row("group thresholds with equal precision: FPR A, B", f"{eq_ppv['A']['fpr']:.3f}, {eq_ppv['B']['fpr']:.3f}")
assert abs(eq_fpr["A"]["fpr"] - eq_fpr["B"]["fpr"]) < 0.01 and eq_fpr["B"]["ppv"] - eq_fpr["A"]["ppv"] > 0.1
assert abs(eq_ppv["A"]["ppv"] - eq_ppv["B"]["ppv"]) < 0.01 and eq_ppv["B"]["fpr"] - eq_ppv["A"]["fpr"] > 0.15
for m in fairness.laplace()["mechanisms"]:
assert abs(m["max_ratio"] - math.exp(m["eps"])) < 1e-3, "the Laplace mechanism's worst ratio is e^eps"
rr = fairness.randomized_response(n=20000, seed=1965 + seed)
lab.row("randomized response, 20,000 people, true share 0.30", f"estimate {rr['estimate']:.3f} +/- {rr['se']:.3f} (eps = ln 3)")
assert abs(rr["estimate"] - rr["sample_true"]) < 4 * rr["se"] and abs(rr["eps"] - math.log(3)) < 1e-4
rec = fairness.reconstruction(seed=2003 + seed)
got = {r["noise"]: r["recovered"] for r in rec["results"]}
lab.row("secret bits rebuilt from noisy sums: noise 1, 4, 16", f"{got[1.0]:.0%}, {got[4.0]:.0%}, {got[16.0]:.0%} (sqrt(n) = {rec['sqrt_n']:.0f})")
assert got[0.0] == 1.0 and got[1.0] > 0.97 and got[16.0] < got[1.0] - 0.15, "small noise protects nothing"
x = tuple(np.round(rng.uniform(0.2, 2.0, 3), 2))
ex = fairness.explain(x=x)
inc, hist, debt = x
by_hand = [0.4 * inc + 0.1 * inc * hist, 0.3 * hist + 0.1 * inc * hist, -0.5 * debt]
lab.row(f"Shapley values at income, history, debt = {inc}, {hist}, {debt}", ", ".join(f"{p:+.3f}" for p in ex["phi"]))
assert ex["sum_ok"] and np.allclose(ex["phi"], by_hand, atol=1e-3), "the interaction is split equally"
lab.note = ("The score treats everyone alike and is calibrated in both groups, yet with unequal base rates no "
"threshold policy equalizes error rates and precision together: which gap to accept is a moral "
"choice. Noise protects a count only when it is large compared with the square root of the data.")
fig, ax = labs.figure(2, size=(11.5, 4.3))
ts = sw["ts"]
for g, color in (("A", labs.BLUE), ("B", labs.ORANGE)):
ax[0].plot(ts, [r["fpr"] for r in sw["rates"][g]], color=color, label=f"group {g}: false-positive rate")
ax[0].plot(ts, [r["ppv"] for r in sw["rates"][g]], color=color, ls="--", label=f"group {g}: precision")
ax[0].axvline(0.5, color=labs.MUTED, ls=":", lw=1)
ax[0].set(title="One threshold for two calibrated groups", xlabel="threshold on the score", ylabel="rate", ylim=(0, 1.3),
yticks=[0, 0.2, 0.4, 0.6, 0.8, 1.0])
ax[0].legend(loc="upper center", ncol=2, fontsize=8)
noise = [r["noise"] for r in rec["results"]]
xs = np.arange(len(noise))
hit = np.array([got[e] > 0.9 for e in noise])
ax[1].set_axisbelow(True)
ax[1].bar(xs[hit], [got[e] for e in np.array(noise)[hit]], color=labs.RED, label="over 90% rebuilt")
ax[1].bar(xs[~hit], [got[e] for e in np.array(noise)[~hit]], color=labs.BLUE, label="under 90%")
ax[1].axhline(0.5, color=labs.INK, ls="--", lw=1, label="guessing")
ax[1].set(title="Rebuilding 64 secret bits from 256 noisy sums", xticks=xs, xticklabels=[f"{e:g}" for e in noise],
xlabel="size of the noise added to each answer", ylabel="share of bits recovered", ylim=(0, 1.3),
yticks=[0, 0.2, 0.4, 0.6, 0.8, 1.0])
ax[1].legend(loc="upper center", ncol=3)
lab.fig = fig
return lab
Now change it
- Call fairness.population with means=(0.4, 0.4). Which of the gaps between the groups at threshold 0.5 disappear, and which remain as sampling noise?
- In fairness.reconstruction ask only n queries instead of 4n (edit m). How much noise is now enough to protect the secret bits?
- Change the randomized-response coin so that people answer truthfully with probability 3/4. Derive the new estimator and epsilon, and compare the standard error.
Problems, with solutions
Try each problem before opening its solution.
-
Derive Chouldechova's identity from the four cells of the confusion table.
Solution
Write the four cells as TP, FP, FN, TN, with \(N\) people in all, prevalence \(p = (TP + FN)/N\), \(\text{PPV} = TP/(TP + FP)\), \(\text{FNR} = FN/(TP + FN)\) and \(\text{FPR} = FP/(FP + TN)\). From the PPV, \(FP = TP\,(1 - \text{PPV})/\text{PPV}\). From the FNR, \(TP = (1 - \text{FNR})(TP + FN) = (1 - \text{FNR})\,pN\). And \(FP + TN = (1 - p)N\). Dividing, \(\text{FPR} = \dfrac{p}{1 - p}\cdot\dfrac{1 - \text{PPV}}{\text{PPV}}\cdot(1 - \text{FNR})\). So if two groups have equal PPV and equal FNR but different prevalence \(p\), their false-positive rates must differ.
-
Show that a perfect predictor satisfies calibration and both balance conditions.
Solution
A perfect predictor gives score \(S = Y\). Calibration: among those scored 1, everyone reoffends, and among those scored 0, no one does, in every group, so \(P(Y = 1 \mid S = s, A) = s\). Balance for the positive class: \(E[S \mid Y = 1, A] = 1\) in every group; for the negative class, \(E[S \mid Y = 0, A] = 0\) in every group. All three hold at once, which is one of the two escape routes from Kleinberg, Mullainathan and Raghavan's theorem (the other is equal base rates).
-
Why does a classifier that labels everyone high risk satisfy demographic parity?
Solution
Demographic parity asks that the share labelled high risk be the same in every group. If everyone is labelled high risk, that share is 1 in every group, so parity holds. (So do equal false-positive rates, all 1, and equal false-negative rates, all 0.) The classifier is useless and harsh on everyone: parity is a constraint on how labels are spread across groups, not on whether they track anything, which is why it is usually paired with accuracy.
-
Compute ε for randomized response with a coin that shows heads with probability 3/4.
Solution
Use Warner's protocol with the biased coin for both tosses: heads (probability \(3/4\)), answer truthfully; tails, toss again and say yes on heads. Then \(P(\text{yes} \mid \text{trait}) = \tfrac34 + \tfrac14\cdot\tfrac34 = \tfrac{15}{16}\), \(P(\text{yes} \mid \text{no trait}) = \tfrac14\cdot\tfrac34 = \tfrac{3}{16}\), \(P(\text{no} \mid \text{no trait}) = \tfrac34 + \tfrac14\cdot\tfrac14 = \tfrac{13}{16}\) and \(P(\text{no} \mid \text{trait}) = \tfrac{1}{16}\). The privacy loss is the largest log ratio: \(\max(\ln 5, \ln 13) = \ln 13 \approx 2.56\), against \(\ln 3\) for the fair coin. (If only the first coin is biased and the second is fair, the ratios are 7 both ways and \(\varepsilon = \ln 7 \approx 1.95\).) More truth, less privacy.
-
Two queries with ε = 0.5 each: what is the total by basic composition?
Solution
Basic composition adds the budgets: \(0.5 + 0.5 = 1\). Two \(0.5\)-differentially private releases together are \(1\)-differentially private, which bounds the ratio of output probabilities with and without any one person by \(e^1 \approx 2.72\).
-
Find the Shapley values of f = x₁x₂ at (1, 1) with baseline (0, 0).
Solution
With baseline \((0, 0)\), average each feature's marginal contribution over the two orders of adding them. Adding \(x_1\) first: \(f(1, 0) - f(0, 0) = 0\); then \(x_2\) adds \(f(1, 1) - f(1, 0) = 1\). Adding \(x_2\) first: it adds 0, then \(x_1\) adds 1. So \(\varphi_1 = \tfrac12(0 + 1) = \tfrac12\) and \(\varphi_2 = \tfrac12\). They sum to \(f(1, 1) - f(0, 0) = 1\) (efficiency), and the interaction, which neither feature produces alone, is split equally (symmetry).
Notes and sources
About this partfrom its README
Part 41 of Philosophy, Built (series plan, syllabus), the first of the two closing parts on the reasoners we build: fairness, discrimination, privacy and explanation in machines that decide. The COMPAS dispute (ProPublica and Northpointe, 2016) with both sides' numbers; State v. Loomis; Dressel and Farid; lending, hiring, health (Obermeyer et al. 2019) and faces (Buolamwini and Gebru 2018); the history of actuarial prediction (Burgess 1928; Meehl 1954; Grove et al. 2000; Harcourt's Against Prediction) and pretrial reform (New Jersey 2017; California's Proposition 25, 2020). Independence, separation and sufficiency (Barocas, Hardt and Narayanan), their incompatibilities and exceptional cases, with a threshold swept across two calibrated populations built by the Reasoner (base rates 30% and 50%; false-positive rates about 10% and 30% at 0.5); what the label measures (Lum and Isaac; Ensign et al.; Jacobs and Wallach). Chouldechova's identity derived on screen and checked; Kleinberg, Mullainathan and Raghavan's calibration and balance computed, and their impossibility proved in four lines and checked on the population (base-rate odds 0.42 and 1.02 against y/(1−x) 0.43 and 0.99); a Price List for the trilemma — the Wall's forty-first brick. Group-specific thresholds searched (equal false positives, equal precision) and a ledger of four policies (one threshold makes the fewest errors; equal precision costs 168 more errors but misses 980 more reoffenders; demographic parity costs 932 and reverses the gap); Corbett-Davies et al., Hardt, Price and Srebro, fair training, multicalibration. Hedden's coins, Long, Hellman, Binns, Rawls and Roemer; SFFA v. Harvard (2023) and Ho and Xiang; Friedler, Scheidegger and Venkatasubramanian's two worldviews. Individual fairness (Dwork et al. 2012); counterfactual fairness on a structural causal model (Kusner et al. 2017); Kohler-Hausmann and path-specific effects; intersectionality (Crenshaw 1989) and fairness gerrymandering (Kearns et al. 2018). Disparate treatment and impact (Griggs, 1971), statistical discrimination (Phelps; Arrow), fairness through unawareness tested (a neighbourhood proxy labels 20% of A and 80% of B), Lippert-Rasmussen, Hellman (2008), Eidelson; audits; insurance (Test-Achats 2011; GINA 2008). Differential privacy (Dwork, McSherry, Nissim and Smith 2006): the failure of anonymization (Sweeney; Netflix; AOL), the Laplace mechanism with its e^ε ratio checked, randomized response simulated, basic and advanced composition, the Dinur–Nissim reconstruction attack run, central and local models, DP-SGD and its disparate cost. Contextual integrity (Nissenbaum 2010), the 2020 census, RAPPOR, Warren and Brandeis, Rachels, Solove, Zuboff; memorization in large models (Carlini et al.), the right to erasure and machine unlearning; notice and consent (McDonald and Cranor; Balkin's information fiduciaries). The GDPR and the EU AI Act; Shapley values and counterfactual explanations computed for a toy credit model; recourse (Ustun et al.; Karimi et al.; Venkatasubramanian and Alfano); Rudin, Slack et al., the Rashomon effect, Miller; mechanistic interpretability (Olah et al.; Elhage et al.; Templeton et al.). Burrell's three opacities, computational reliabilism, Matthias's responsibility gap, many hands, meaningful human control; model cards, datasheets, audits, the AI Incident Database; moral crumple zones (Elish), automation bias, Green and Chen; NIST's AI RMF, ISO/IEC 42001 and Canada's Directive on Automated Decision-Making.
The worked model results are computed by the Reasoner's new module explainer/philosophy/reasoner/fairness.py (with
prop for the Price List), tested in tests/philosophy/test_fairness.py and cached by compute.py.
Chapter notes
| # | Scene | What it establishes | Computed on screen |
|---|---|---|---|
| 0 | Hook |
the COMPAS question; four questions; the plan. | — |
| 1 | Compas |
ProPublica; Northpointe; Loomis; Dressel and Farid; Obermeyer et al.; Buolamwini and Gebru; Burgess; Meehl; Grove et al.; Harcourt; pretrial reform. | — |
| 2 | Criteria |
Barocas, Hardt and Narayanan; Lum and Isaac; Ensign et al.; Jacobs and Wallach. | a threshold swept across two populations |
| 3 | Impossible |
Chouldechova; Kleinberg, Mullainathan and Raghavan; the Wall's forty-first brick. | the identity checked; calibration and balance; the four-line proof; the Price List |
| 4 | Thresholds |
Corbett-Davies et al.; Hardt, Price and Srebro; Zafar et al.; Agarwal et al.; Hébert-Johnson et al. | group thresholds; the ledger of four policies |
| 5 | Which |
Hedden; Long; Hellman; Binns; Rawls; Roemer; SFFA v. Harvard; Ho and Xiang; Friedler, Scheidegger and Venkatasubramanian. | — |
| 6 | Individual |
Dwork et al.; Kusner et al.; Kohler-Hausmann; Chiappa; Nabi and Shpitser; Crenshaw; Kearns et al. | counterfactual predictions on a causal model |
| 7 | Discrimination |
Griggs; Phelps; Arrow; Lippert-Rasmussen; Hellman; Eidelson; Gender Shades; Local Law 144; Test-Achats; GINA. | fairness through unawareness, tested |
| 8 | Privacy |
Sweeney; Narayanan and Shmatikov; Dwork, McSherry, Nissim and Smith; Warner; Dinur and Nissim; Abadi et al.; Bagdasaryan et al. | the Laplace mechanism; randomized response; composition; reconstruction |
| 9 | Context |
Nissenbaum; the 2020 census; RAPPOR; Warren and Brandeis; Rachels; Solove; Zuboff; Carlini et al.; Google Spain; Bourtoule et al.; McDonald and Cranor; Balkin. | — |
| 10 | Explain |
the GDPR; Wachter, Mittelstadt and Floridi; the EU AI Act; Lundberg and Lee; Wachter, Mittelstadt and Russell; Ustun et al.; Karimi et al.; Venkatasubramanian and Alfano; Rudin; Slack et al.; Miller; Olah et al.; Elhage et al.; Templeton et al. | Shapley values; counterfactual explanations |
| 11 | Responsibility |
Burrell; Durán and Formanek; Matthias; Thompson; Nissenbaum; Santoni de Sio and Mecacci; Mitchell et al.; Gebru et al.; Raji and Buolamwini; Elish; Skitka et al.; Green and Chen; NIST; ISO/IEC 42001. | — |
| 12 | Outro |
recap; the Reasoner's module; the Wall; problems; payoffs; references. | — |
Notes
The conditional-independence criteria apply to the same prediction variable. A calibrated score can coexist with a separately adjusted binary decision. The Kleinberg trilemma uses equal class-average scores, not error rates of a different thresholded decision; for a binary prediction, those averages are its true-positive and false-positive rates. Perfect predictions and uninformative predictions are explicit exceptional cases in the pairwise comparisons.
The population has 20,000 people per group, each with a true risk drawn from a Beta distribution of concentration 4 and mean 0.3 (group A) or 0.5 (group B), and an outcome drawn from that risk (seed 2016); the score is the true risk, so it is calibrated by construction. Group thresholds are searched on a grid of 181 points from 0.05 to 0.95. The unawareness test gives each person a neighbourhood that matches their group with probability 0.8 (seed 1971) and labels the riskier neighbourhood high risk. The counterfactual model is X = U − A + noise (seed 2017). Randomized response simulates 2,000 respondents with true share 0.3 (seed 1965); the reconstruction attack hides 64 bits behind 256 noisy subset sums and solves by least squares (seed 2003).
Companion material in this repository
The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
- The COMPAS controversy (ProPublica 2016; Northpointe's response; cited) as the motivating case.
- Fairness criteria: demographic parity, equalized odds, equal opportunity, calibration (sufficiency); as independence relations (Barocas, Hardt and Narayanan).
- The impossibility results: Kleinberg, Mullainathan and Raghavan (2016); Chouldechova (2017), proved on screen. Built: a fairness auditor on synthetic data shows that with unequal base rates, no non-trivial classifier meets all three.
- Which criterion is right? Equality of opportunity (Rawls, Roemer) and the philosophical readings of each metric (Hellman; Long).
- Individual fairness: Dwork et al. (2012): "treat similar individuals similarly" as a Lipschitz condition.
- Counterfactual fairness (Kusner et al. 2017) with Part 17's SCM engine; path-specific effects; the problem of "causal effects of race" (Kohler-Hausmann).
- Discrimination: disparate treatment vs impact; statistical discrimination; what makes discrimination wrong (Hellman, Eidelson).
- Privacy: the failures of anonymization (Netflix Prize de-anonymization, 2008; cited); differential privacy (Dwork, McSherry, Nissim and Smith 2006). Built: Laplace mechanism and composition; DP as a philosophical definition of privacy and its critics (contextual integrity, Nissenbaum).
- Explanation: Shapley values and SHAP (callback to Part 34) and their limits; counterfactual explanations (Wachter, Mittelstadt and Russell 2017); the "right to explanation" debate (GDPR, EU AI Act; cited).
- Opacity and trust: epistemic dependence on black boxes; the computational reliabilism view (Durán and Formanek).
- Responsibility gaps (from Part 32): many hands; accountability structures in industry (model cards, audits, incident reporting).
- Industry: fairness in lending, hiring and medicine (cited cases); how audits are actually done.
- Recap and Problems.
Built: reasoner.fairness (criteria; impossibility demonstrations; counterfactual fairness via SCMs); reasoner.dp
(Laplace and exponential mechanisms; composition accounting).
Wall: Kleinberg–Chouldechova (calibration and balance can't both hold with unequal base rates).
Price List: the fairness trilemma, with each correction set paired with the institutions that chose it.
Visuals: score distributions sliding apart with their thresholds; the confusion-matrix tiles recoloring as the
threshold moves; the Laplace noise curve widening as ε shrinks.
References: Barocas, Hardt and Narayanan; Kleinberg et al. 2016 (ITCS 2017); Chouldechova 2017 (Big Data);
Dwork and Roth; Hellman, "Measuring Algorithmic Fairness" (2020); Nissenbaum, Privacy in Context.
Build the film
python -m videos.philosophy.philosophy41.compute # the part's numbers, into .cache/philosophy41
python tools/build.py philosophy41 # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py philosophy41 Hook # one chapter, silent, with a contact sheet
Scenes: videos/philosophy/philosophy41. Setup: see the course page. Source of these notes: the README and the scenes' narration.
Build it
python -m videos.philosophy.philosophy41.compute # every computed item (seconds; .cache/philosophy41)
python tools/build.py philosophy41 -q l # 480p preview
python tools/build.py philosophy41 # 1080p30 -> renders/philosophy41.mp4
python tools/qa_scene.py philosophy41 Impossible # one chapter, silent, with a contact sheet