Algorithmic Game Theory · Lecture Notes

Chapter 11: Algorithmic Fairness and Ethics

Algorithms that approve loan applications, screen résumés, or compute a defendant's risk score make decisions that directly affect people's lives. These decisions can be "accurate" and still load errors onto some groups more than others, systematically. These notes build the ways of measuring fairness on a single numerical example and show why the measures cannot all be satisfied at once. The notes also cover the fair division of resources (cake cutting and the division of indivisible goods), ethical principles, auditing, and people's strategic response to an algorithm.

Learning outcomes

Computing the criteria
Compute demographic parity, equalized odds, predictive parity, and calibration from the confusion matrices of two groups.
Showing the incompatibility
Show numerically why the criteria cannot be satisfied together when base rates differ.
Fair division
Apply the cut-and-choose method; distinguish proportionality from envy-freeness.
Ethics and incentives
Discuss how transparency, accountability, auditing, and strategic behavior affect design.

11.1Introduction

Mechanism design and game theory are mostly concerned with efficiency, that is, with whether a mechanism enlarges total welfare. The question of these notes is different: how are the consequences of a decision or an allocation distributed among individuals and groups? This question arises in two separate areas. The first is the yes/no decisions made by machine learning models. The second is the division of a resource (time, land, an inheritance, course seats) among people. In both areas the word "fair" has no single meaning. So one must first define the different meanings separately, and then study the relations among them.

11.1.1A warm-up game: the Fair Division Game

The chapter's interactive game, the Fair Division Game, rests on a simple rule. Two players pick indivisible items one at a time, taking turns. Each item's card shows the value each of the two players assigns to it. The fixed sample round of the game uses four items; in the other levels the values are drawn at random in each round.

CakeO1:5O2:1BookO1:4O2:9HeadphonesO1:3O2:8BallO1:1O2:1Order: P1, P2, P1, P2P2 (computer) always takes the itemit values most among those left.
Figure 11.1: The sample round of the Fair Division Game. Each card shows the value that the first player (P1) and the second player (P2) assign to the item: Cake 5/1, Book 4/9, Headphones 3/8, Ball 1/1. The picking order is P1, P2, P1, P2; P2 (the computer) takes, each time, the remaining item that is most valuable in its own eyes.

The values in Figure 11.1 show that the two players value the items very differently. P1 likes the Cake most (5), and P2 likes the Book most (9). The game asks two questions:

  • If the opponent always takes its own favorite item, is it best for P1 also always to take the most valuable item?
  • Is there always an allocation in which everyone values their own share at least as much as they value the other's share?

The first question is a game-theoretic one: P1's strategy should be a best response to the opponent's behavior. The second is a fairness question: is an allocation in which "nobody envies anyone else's share" always possible? The answer to both questions is "no". The reasons are worked out in 11.4.8 and 11.4.9. The game shows two things from the start: fairness cannot be described with a single number, and even players who follow the rules can behave strategically.

11.1.2Why do algorithmic decisions matter?

Algorithms now either make high-impact decisions directly or steer them with the recommendations they produce. Loan approval, hiring, medical diagnosis, social media recommendations, and criminal justice are the main such areas. An error in these decisions can cost a person their home, their job, or their freedom.

Violations of fairness and ethics cause two kinds of harm. The first is direct harm: an applicant rejected unjustly cannot get a loan, and a defendant unjustly labeled "high risk" may stay in detention longer. The second is indirect harm: as such incidents become known, public trust in institutions and technology erodes. Once trust is lost, even useful applications are not accepted.

From the viewpoint of game theory, a decision rule is a mechanism. The rule turns inputs (the applicant's data) into outputs (approval or rejection). Around this mechanism there are stakeholders with conflicting interests: the applicant wants a loan, the institution wants to avoid loans that are not repaid, and society wants opportunities to be distributed equitably among groups. As in mechanism design, which objective to pursue is a design decision here too.

Three examples show how the problem appears in real life:

  • Amazon's hiring tool (2018). The company's screening model, trained on past résumés, penalized applications that contained the word "women's" (for example "captain of the women's chess club"). The model had learned this pattern from data in which mostly men had been hired in the past. The tool was withdrawn (Dastin, 2018).
  • COMPAS (2016). A recidivism risk score computed for defendants in the United States. Journalists showed that the score produced different error rates for Black and white defendants; the company argued that the score conveyed the same risk in both groups (Angwin et al., 2016). This debate is the best-known example of how fairness criteria conflict when base rates differ. It is worked out with numbers in 11.3.5.
  • Credit scoring. Two questions stand out here. Does the same score indicate the same risk for everyone? Who cannot get credit at all? The first reflects the viewpoint of the institution, the second that of the applicant. The numerical example of the chapter is also a credit model.

11.1.3Where do bias and discrimination come from?

For a model to produce unfair results, the person who wrote it need not have ill intent. Bias can seep in at many points in the process in which a model is developed and used. Four sources stand out.

Historical data
Past inequalities are reflected in the data labels. The model treats these labels as the "right answer" and learns to reproduce them. The gender bias in the Amazon example is a case in point: the label "was hired in the past" recorded not merit but the hiring habits of the past.
Underrepresentation
If a group is thinly represented in the data, the model makes more errors on that group. The model tries to minimize the total error in training; the errors on a small number of examples contribute little to this total. In commercial face recognition systems, the highest error rate has been measured for darker-skinned women (Buolamwini and Gebru, 2018; the "Gender Shades" study).
Measurement and proxy variables
Instead of the target one really wants to measure, an easily measured proxy variable may be used. For example, if "health spending" is measured instead of "health need", a group with less access to health care looks healthier because it spends less. The model systematically underestimates this group's need.
Design and feedback
A wrongly chosen optimization objective, proxies for the protected attribute (for example the postal code), and the model's decisions changing the data that will be collected in the future belong to this group. The last case is a feedback loop; the code trace in 11.5.6 shows such a loop step by step.

An important lesson comes out of these sources. A protected attribute, that is, an attribute such as gender or ethnic origin on which discrimination is prohibited, does not solve the problem even if it is removed from the model. The other variables carry it indirectly. If neighborhoods in a city are segregated by ethnic origin, the postal code is a good proxy for ethnic origin. The model can reproduce the same group difference by using the postal code. Therefore the way to secure fairness is not to delete a column from the input but to measure outcomes by group.

Common mistake
  • "If the model does not see gender, it is fair." This approach is called "fairness through unawareness", and it often fails because of proxy variables. Moreover, once the protected attribute is deleted, measuring outcomes by group also becomes harder.
  • "The data reflect reality; the model only learns it." Data are a record of past decisions and of the ways of measuring. If the label is a proxy, or was collected through past decisions, then what we take to be "reality" is already distorted.
  • "Bias comes only from the training data." The choice of the target, the setting of the threshold, and the context in which the model is used are also sources of bias.

11.2Fairness criteria

To discuss whether a model is "fair", one must first agree on what is to be measured. All four basic criteria are derived from the confusion matrix, which summarizes the results of a model that makes binary (yes/no) decisions. The same two groups and the same model are used in all the computations. In this way the differences among the criteria come not from changing numbers but from changing the question that is asked.

11.2.1The confusion matrix

Consider a credit model. For each applicant there are two things. The first is the actual outcome: does the person really repay the loan? This outcome is denoted Y; Y = 1 means "repays" and Y = 0 means "does not repay". The second is the model's decision: does the model approve the loan? This decision is denoted Ŷ ("Y hat"); Ŷ = 1 means "approve" and Ŷ = 0 means "reject". The hat is a reminder that this is a prediction, not a true value.

The two binary variables have four combinations. Each applicant falls into one of these four boxes. The table that shows the number of people in the boxes is called the confusion matrix.

Definition 11.1

The confusion matrix is a 2 × 2 table showing the number of people in the four combinations of the actual outcome Y and the model's decision Ŷ:

  • TP (true positive): repays and was approved (Y = 1, Ŷ = 1);
  • FN (false negative): would repay but was rejected (Y = 1, Ŷ = 0);
  • FP (false positive): does not repay but was approved (Y = 0, Ŷ = 1);
  • TN (true negative): does not repay and was rejected (Y = 0, Ŷ = 0).

The total number of applicants is n = TP + FP + FN + TN.

The naming has a logic. The second letter (P or N) says what the model said: P is "positive", that is, approve; N is "negative", that is, reject. The first letter (T or F) says whether this statement was true or false. FN is "false negative": the model said "no" and was wrong, because the person would in fact have repaid.

Five rates are derived from the matrix. Each rate looks at a particular row or column of the matrix and answers a different question.

Table 11.1: Rates derived from the confusion matrix (credit example).
RateDefinitionQuestionWhere in the matrix?
Selection rate(TP + FP) / nWhat fraction is approved?approve column, whole group
TPR (true positive rate)TP / (TP + FN)What fraction of those who would repay were approved?"repays" row
FPR (false positive rate)FP / (FP + TN)What fraction of those who would not repay were approved?"does not repay" row
PPV (precision)TP / (TP + FP)What fraction of those approved repay?approve column
Base rate p(TP + FN) / nShare of those who repay in the group"repays" row, whole group

These rates can also be written as conditional probabilities. The conditional probability P(A | B) means "the probability of A given that B is known" and is the share of A among only those who satisfy B. TPR is the share of those approved among those who repay: TPR = P(Ŷ = 1 | Y = 1). FPR is the share of those approved among those who do not repay: FPR = P(Ŷ = 1 | Y = 0). PPV reverses the direction: it is the share of those who repay among those approved: PPV = P(Y = 1 | Ŷ = 1). To avoid confusing TPR with PPV, the rule "the condition to the right of the bar says which crowd we are counting in" helps. In TPR the crowd is those who repay; in PPV it is those who are approved. The denominators of these two rates differ, and they generally give different numbers.

TPR is also called sensitivity in medicine and statistics. Another name for PPV is precision. The base rate is independent of the model: it does not look at what the model decides, and only measures the frequency of the actual outcome in the group. Even if the model changes, the base rate does not. One of the main results of the chapter is that when base rates differ, the criteria cannot be satisfied together (11.3).

Every group fairness criterion asks for one of these rates to be equal across groups. Which rate is to be equalized is not a technical detail but a choice of values: it is an answer to which error matters more, and to whom.

11.2.2Example: two groups, one model

The example used throughout the chapter is this. There are 100 applicants in each of two groups, A and B. The model gives each applicant one of two scores: 0.8 ("low risk") or 0.2 ("high risk"). The model decides with a threshold of 0.5: those with a score above 0.5 are approved, and the others are rejected. The table below shows how many people in each score class actually repay.

Table 11.2: Sample data. 100 applicants in each group; the model gives two scores.
groupscorepeoplerepaydefaultdecision (threshold 0.5)
A0.80504010approve
A0.20501040reject
B0.8020164approve
B0.20801664reject

The first observation from the table is that the two groups really are different. In group A, those who repay number 40 + 10 = 50; the base rate is pA = 50/100 = 0.50. In group B, those who repay number 16 + 16 = 32; the base rate is pB = 0.32. The second observation is that the model gives a high score less often to group B: in A, 50 people get 0.8, while in B only 20 do.

Example 11.1

The confusion matrices of the two groups are built from Table 11.2.

  1. Those approved. Those with a score of 0.8 are approved. In A, 40 of them repay (TP = 40) and 10 do not (FP = 10). In B, 16 repay (TP = 16) and 4 do not (FP = 4).
  2. Those rejected. Those with a score of 0.2 are rejected. In A, 10 of them are people who would in fact repay (FN = 10), and 40 are correctly rejected (TN = 40). In B there are 16 FN and 64 TN.
  3. Check. The four cells of each matrix must sum to 100: in A, 40 + 10 + 10 + 40 = 100; in B, 16 + 4 + 16 + 64 = 100 ✓.
  4. Accuracy. The people for whom the model decides correctly are in the TP and TN boxes. Accuracy is (TP + TN)/n. In A it is (40 + 40)/100 = 0.80, in B (16 + 64)/100 = 0.80.

The model is 80% accurate in both groups. At first glance this gives the impression that the model treats the two groups equally. But that impression is incomplete; the criteria bring out what is missing, in numbers.

Group Aapprove (Ŷ=1)reject (Ŷ=0)repays (Y=1)defaults (Y=0)TP40FN10FP10TN40 Group Bapprove (Ŷ=1)reject (Ŷ=0)repays (Y=1)defaults (Y=0)TP16FN16FP4TN64
Figure 11.2: The confusion matrices of the two groups. Rows show the actual outcome (repays Y = 1, defaults Y = 0), columns the model's decision (approve Ŷ = 1, reject Ŷ = 0). A: TP = 40, FN = 10, FP = 10, TN = 40. B: TP = 16, FN = 16, FP = 4, TN = 64.

Figure 11.2 shows the two matrices side by side. The rows of the matrix are separated by the truth and the columns by the decision. This layout makes it easier to see which cells the later criteria look at: rates computed along a row (TPR, FPR) ask "given the actual outcome, what did the model do?", while those computed along a column (PPV) ask "given the decision, what did the truth turn out to be?".

11.2.3Demographic parity

The simplest fairness idea is that the two groups be approved at equal rates. This idea does not look at how accurate the model is; it looks only at the distribution of outcomes.

Definition 11.2

Demographic parity means that the selection rates of the two groups are equal:

P(Ŷ = 1 | A) = P(Ŷ = 1 | B).

Here P(Ŷ = 1 | A) = (TPA + FPA) / nA is the selection rate of group A.

Example 11.2
  1. The approve column. The selection rate looks only at the approve column. In A the number approved is 40 + 10 = 50, in B it is 16 + 4 = 20.
  2. Selection rates. A: 50/100 = 0.50. B: 20/100 = 0.20. The difference is 0.50 − 0.20 = 0.30. Demographic parity does not hold.
  3. The four-fifths rule. The ratio of the smaller selection rate to the larger is 0.20 / 0.50 = 0.40. Since this number is below 0.8, the rule defined below is violated as well.
  4. The groups differ. In reality those who repay number 50 in A and 32 in B. Raising the selection rate in B to 0.50 means raising the number approved from 20 to 50. Since only 32 people in B repay, at least 50 − 32 = 18 of these new approvals go to people who will not repay. Conversely, lowering A to 0.20 means rejecting at least 30 of the 50 people who would repay.
Group Aapprove (Ŷ=1)reject (Ŷ=0)repays (Y=1)defaults (Y=0)TP40FN10FP10TN40 Group Bapprove (Ŷ=1)reject (Ŷ=0)repays (Y=1)defaults (Y=0)TP16FN16FP4TN64
Figure 11.3: The cells that demographic parity looks at: the approve column (TP + FP). In A, 50 people are approved; in B, 20; the selection rates are 0.50 and 0.20.

In US employment law a practical version of this criterion is used. In hiring, if the selection rate of a group is less than four-fifths (80%) of the selection rate of the group with the highest rate, this is taken as first evidence of disparate impact.

Definition 11.3

The four-fifths rule requires that the ratio of the smaller selection rate to the larger be at least 0.8:

min(sA, sB) / max(sA, sB) ≥ 0.8.

The rule looks at a ratio, not a difference. This distinction matters. If the selection rates are 0.50 and 0.40, the difference is 0.10 and the ratio is 0.8; the rule is met at the limit. If the selection rates are 0.10 and 0.02, the difference is only 0.08 but the ratio is 0.2; the rule is clearly violated. At small rates a difference looks misleadingly small.

The attractive side of demographic parity is that it does not require knowing the actual outcome Y. If the labels themselves carry historical bias (11.1.3), a criterion that does not rely on labels is advantageous. Its weak side shows in the last step above: if the base rates really differ, forcing this criterion means either giving credit to people who will not repay or rejecting people who would repay. Both are a kind of error, and the cost of these errors is also placed on some group.

11.2.4Equalized odds and equal opportunity

The second idea takes the actual outcome into account. The question is: does the chance of being approved of two people in the same actual situation change with their group? If of two people who will repay one is in A and the other in B, their chances of approval should be equal. The same should hold for people who will not repay.

Definition 11.4

Equalized odds (Hardt et al., 2016) means that the error rates, conditional on the actual outcome, are equal across groups:

TPRA = TPRB and FPRA = FPRB.

If only TPR equality is required, the criterion is called equal opportunity.

The name of equal opportunity describes its content: the opportunity of everyone who "deserves" approval, that is, who will repay the loan, to get approved should be independent of their group. Equalized odds adds a second condition: the chance that those who do not deserve it are approved by mistake should also be independent of group.

Example 11.3
  1. TPR (the "repays" row). A: 40/(40 + 10) = 40/50 = 0.80. B: 16/(16 + 16) = 16/32 = 0.50. In B, half of those who will repay the loan are rejected; in A this share is one fifth.
  2. FPR (the "does not repay" row). A: 10/(10 + 40) = 10/50 = 0.20. B: 4/(4 + 64) = 4/68 ≈ 0.059.
  3. Comparison. The TPR gap is 0.80 − 0.50 = 0.30 and the FPR gap is 0.20 − 0.059 = 0.141. Since both rates differ, equalized odds does not hold. Equal opportunity, which looks only at TPR, does not hold either.

The result paints an interesting picture: group B is treated differently from A in both directions. Members of B who will repay are rejected more often (low TPR); members of B who will not repay are approved less often (low FPR). The model is, overall, "more cautious" toward B.

Group Aapprove (Ŷ=1)reject (Ŷ=0)repays (Y=1)defaults (Y=0)TP40FN10FP10TN40 Group Bapprove (Ŷ=1)reject (Ŷ=0)repays (Y=1)defaults (Y=0)TP16FN16FP4TN64 Group Aapprove (Ŷ=1)reject (Ŷ=0)repays (Y=1)defaults (Y=0)TP40FN10FP10TN40 Group Bapprove (Ŷ=1)reject (Ŷ=0)repays (Y=1)defaults (Y=0)TP16FN16FP4TN64
Figure 11.4: The cells that equalized odds looks at. Top row: the "repays" row for TPR (40/50 = 0.80 in A, 16/32 = 0.50 in B). Bottom row: the "does not repay" row for FPR (10/50 = 0.20 in A, 4/68 ≈ 0.059 in B).

Figure 11.4 shows that this criterion works by rows. The viewpoint of this criterion is that of the applicant. An applicant who would repay asks: "As someone who would repay, does my chance of approval depend on my group?" The chance of an applicant who would repay is 80% in A and 50% in B. This difference is explained not by the applicant's own behavior but only by the group.

The complement of TPR is also used often. The false negative rate (FNR) is the share of those rejected among those who would repay: FNR = FN/(TP + FN) = 1 − TPR. In the example FNR is 0.20 in A and 0.50 in B. Equality of TPR and equality of FNR are the same condition; the FNR form is used in the COMPAS debate (11.3.5).

11.2.5Predictive parity

The third idea moves the viewpoint to the institution's side. The institution uses the model's "approve" decision as a piece of information. The meaning of this information should be the same in the two groups: an approved member of A and an approved member of B should repay the loan with the same probability.

Definition 11.5

Predictive parity means that the rate at which those approved actually repay, that is, the PPV, is equal across groups:

PPVA = PPVB, where PPV = TP/(TP + FP) = P(Y = 1 | Ŷ = 1).

The counterpart on the reject side is the negative predictive value (NPV): the share of those rejected who really do not repay, NPV = TN/(TN + FN).

Example 11.4
  1. PPV (the approve column). A: 40/(40 + 10) = 0.80. B: 16/(16 + 4) = 16/20 = 0.80. In both groups 80% of those approved repay; predictive parity holds.
  2. NPV (the reject column). A: 40/(40 + 10) = 40/50 = 0.80. B: 64/(64 + 16) = 64/80 = 0.80. Of those rejected, too, 80% in both groups really do not repay.

The labels "approve" and "reject" carry the same meaning in the two groups. For the institution the model is equally reliable in both groups.

Group Aapprove (Ŷ=1)reject (Ŷ=0)repays (Y=1)defaults (Y=0)TP40FN10FP10TN40 Group Bapprove (Ŷ=1)reject (Ŷ=0)repays (Y=1)defaults (Y=0)TP16FN16FP4TN64 Group Aapprove (Ŷ=1)reject (Ŷ=0)repays (Y=1)defaults (Y=0)TP40FN10FP10TN40 Group Bapprove (Ŷ=1)reject (Ŷ=0)repays (Y=1)defaults (Y=0)TP16FN16FP4TN64
Figure 11.5: The cells that predictive parity looks at. Top row: the approve column for PPV (40/50 in A, 16/20 in B; both 0.80). Bottom row: the reject column for NPV (40/50 in A, 64/80 in B; both 0.80).

The same model, the same numbers: by equalized odds, group B is disadvantaged; by predictive parity, the model behaves the same toward both groups. There is no contradiction; the two criteria look at different directions of the matrix. Figure 11.4 compares rows and Figure 11.5 compares columns. Which direction matters depends on whose viewpoint is given priority.

11.2.6Calibration

The criteria so far looked at the model's approve/reject decision. But the model first produces a score; the decision is made by comparing this score with a threshold. The score itself also makes a claim: "this person's probability of repaying is 0.8." Calibration asks whether this claim is true.

Definition 11.6

Calibration (calibration within groups): the actual repayment rate of people with score s is s in every group:

P(Y = 1 | score = s, group = g) = s, for every s and every g.

Calibration means that the score conveys the same risk whatever the group. Consider a weather app: if of the days on which it says "30% chance of rain" it actually rains on about 30%, the app is calibrated. That calibration is within groups means that this check is made separately for each group. A model can be calibrated overall and still systematically inflate the scores in one group.

Example 11.5

For each of the four rows of Table 11.2, the realized rate is computed and compared with the score.

  1. Group A, score 0.8: 40 of 50 repay ⇒ 40/50 = 0.80. Same as the score.
  2. Group A, score 0.2: 10 of 50 repay ⇒ 10/50 = 0.20. Same as the score.
  3. Group B, score 0.8: 16 of 20 repay ⇒ 16/20 = 0.80. Same as the score.
  4. Group B, score 0.2: 16 of 80 repay ⇒ 16/80 = 0.20. Same as the score.

In all four rows the score equals the realized rate. The model is calibrated in both groups: the score is an honest probability.

Table 11.3: The calibration check. Realized rate = repay / people.
groupscore speoplerepayrealized rateequals s?
A0.80504040/50 = 0.80yes
A0.20501010/50 = 0.20yes
B0.80201616/20 = 0.80yes
B0.20801616/80 = 0.20yes

Calibration and predictive parity are closely related but not the same. Predictive parity looks only at the "approve" column, that is, at everyone above the threshold together. Calibration looks at each score level separately. In this example there is a single score above the threshold (0.8), so calibration directly gives PPV equality: all those approved have the score 0.8, and in a calibrated model 80% of them repay. In a model with more score levels, the mix of scores among those approved can differ in the two groups; then even a calibrated model can give different PPVs.

A calibrated model has an interesting property: the average score in a group equals the base rate of that group. In A the average score is (50 · 0.8 + 50 · 0.2)/100 = 0.50 = pA, in B it is (20 · 0.8 + 80 · 0.2)/100 = 0.32 = pB. For this reason, if the base rates differ, a calibrated model must give the two groups different scores on average. This observation is the core of Kleinberg's theorem in 11.3.3.

11.2.7Code trace: metrics()

All four group criteria are computed from the four numbers of the confusion matrix. The short Python function below does this computation and prints the results of the two groups side by side.

def metrics(TP, FP, FN, TN):
  n = TP + FP + FN + TN
  sel = (TP + FP) / n     # demographic parity
  tpr = TP / (TP + FN)    # equalized odds
  fpr = FP / (FP + TN)
  ppv = TP / (TP + FP)    # predictive parity
  return sel, tpr, fpr, ppv

A = metrics(40, 10, 10, 40)
B = metrics(16, 4, 16, 64)
NAMES = ["sel", "TPR", "FPR", "PPV"]
for i, name in enumerate(NAMES):
  print(name, round(A[i], 3), round(B[i], 3))

The function takes four arguments: TP, FP, FN, and TN. In the first line the total number of people n is computed. The next four lines apply the definitions of Table 11.1 one to one. The comments say in which criterion each rate is used: sel is compared in demographic parity, tpr and fpr in equalized odds, and ppv in predictive parity. The function returns the four numbers as a Python tuple. A tuple is an immutable, ordered list of comma-separated values; A[0] gives the first value and A[3] the last.

The lower part of the program calls the function with the matrices of the two groups. The line for i, name in enumerate(NAMES) gives, for each name in the list, both its position (i) and the name itself (name). So A[i] and B[i] are the values of the same rate in the two groups.

Table 11.4: Trace of metrics(). A = metrics(40, 10, 10, 40), B = metrics(16, 4, 16, 64).
LineGroup AGroup B
n40 + 10 + 10 + 40 = 10016 + 4 + 16 + 64 = 100
sel(40 + 10)/100 = 0.5(16 + 4)/100 = 0.2
tpr40/(40 + 10) = 0.816/(16 + 16) = 0.5
fpr10/(10 + 40) = 0.24/(4 + 64) ≈ 0.0588
ppv40/(40 + 10) = 0.816/(16 + 4) = 0.8
return(0.5, 0.8, 0.2, 0.8)(0.2, 0.5, 0.0588…, 0.8)

The loop prints four lines: sel 0.5 0.2, TPR 0.8 0.5, FPR 0.2 0.059, PPV 0.8 0.8. Reading the output line by line, the status of the criteria is immediately visible. At i = 0 the selection rates differ (0.5 ≠ 0.2): no demographic parity. At i = 1 the TPRs differ: no equal opportunity. At i = 2 the FPRs differ as well: no equalized odds. At i = 3 the PPVs are equal: predictive parity holds.

Example 11.6

Let the matrix of a third group, C, be TP = 30, FP = 20, FN = 10, TN = 40. The function is called as metrics(30, 20, 10, 40).

  1. n = 30 + 20 + 10 + 40 = 100.
  2. Selection rate (30 + 20)/100 = 0.5.
  3. TPR = 30/(30 + 10) = 30/40 = 0.75.
  4. FPR = 20/(20 + 40) = 20/60 ≈ 0.333.
  5. PPV = 30/(30 + 20) = 30/50 = 0.6.

Let us compare C with A: A's four values are (0.5, 0.8, 0.2, 0.8). Only the selection rates are equal (0.5 = 0.5); demographic parity holds. TPR (0.75 ≠ 0.8), FPR (0.333 ≠ 0.2), and PPV (0.6 ≠ 0.8) differ. So the two groups being approved at the same rate does not mean the approvals are handed out with the same accuracy.

11.2.8All criteria, one model: the scorecard

All the computations can be gathered in one table. The table shows plainly that the same model can count as fair by one criterion and unfair by another.

Table 11.5: All criteria, one model. The status of the example model under all the criteria.
CriterionWhat must be equalABSatisfied?
Demographic parityP(Ŷ = 1)0.500.20no
Equal opportunityTPR = P(Ŷ = 1 | Y = 1)0.800.50no
Equalized oddsTPR and FPR = P(Ŷ = 1 | Y = 0)0.80; 0.200.50; 0.059no
Predictive parityPPV = P(Y = 1 | Ŷ = 1)0.800.80yes
CalibrationP(Y = 1 | score = s) = s0.8→0.8; 0.2→0.20.8→0.8; 0.2→0.2yes

The criteria in the table fall into two viewpoints:

  • The applicant's viewpoint: "As someone who would repay, does my chance of approval depend on my group?" This question holds the actual outcome fixed and looks at the distribution of the decision ⇒ TPR and FPR (equal opportunity, equalized odds).
  • The institution's viewpoint: "Does the repayment probability of a person I approve depend on their group?" This question holds the decision or the score fixed and looks at the distribution of the actual outcome ⇒ PPV and calibration.

Demographic parity falls outside these two viewpoints; it does not use the actual outcome at all and is concerned only with the numerical distribution of opportunities. The example model satisfies the institution's criteria and does not satisfy the applicant's. This is not a coincidence: it is unavoidable as long as the base rates differ (11.3).

11.2.9Beyond group fairness: individual fairness

All of the criteria above are group fairness criteria: they compare the average rates of groups. While averages are being equalized, individuals can be treated arbitrarily. For example, additionally approving 30 randomly chosen people from group B raises B's selection rate to 0.50 and achieves demographic parity. But which 30 people get approved depends entirely on chance; of two very similar members of B, one is approved and the other is not. Dwork et al. (2012) approach this problem with a different principle: similar individuals should be treated similarly.

Definition 11.7

Individual fairness means that the model score satisfies the Lipschitz condition: for every two people x and y,

|f(x) − f(y)| ≤ L · d(x, y).

Here f(x) is the model score of person x; d(x, y) is the distance that measures how different the two people are from each other; L is the largest slope allowed.

The condition says that the difference in two people's scores must not exceed L times the difference between them. If d(x, y) is small, that is, if the people are similar, their scores must also be close to each other. The name "Lipschitz" comes from a continuity condition in mathematics: functions whose graph is nowhere steeper than L satisfy this condition. A function that makes a sudden jump violates the condition, because it gives very different values to two very close points on either side of the jump.

...similarity axis (e.g. debt/income)model score fEceNurstep: |Δf| = 0.6slope L = 2: |Δf| = 0.1
Figure 11.6: Individual fairness. The horizontal axis is a similarity measure (for example the debt-to-income ratio), the vertical axis is the model score. The red step model gives Ece and Nur, on either side of the threshold, 0.2 and 0.8: |Δf| = 0.6. The green dashed model rises with slope L = 2 and gives the same two people a difference of at most 0.1.
Example 11.7

In Figure 11.6 the distance between Ece and Nur is d = 0.05 and the allowed slope is L = 2.

  1. The largest allowed difference: L · d = 2 · 0.05 = 0.1.
  2. The step model: gives Ece 0.2 and Nur 0.8. The difference is |0.8 − 0.2| = 0.6. Since 0.6 > 0.1, the condition is violated.
  3. The smooth model: raises the score gradually so that the slope does not exceed 2. The difference in the two people's scores is at most 2 · 0.05 = 0.1; the condition holds.
  4. A question about a range: let L = 2, d(x, y) = 0.1, and f(x) = 0.8. The condition gives |f(y) − 0.8| ≤ 2 · 0.1 = 0.2; that is, 0.6 ≤ f(y) ≤ 1.0. Since the upper bound is already the largest value a score can take, the allowed range is [0.6, 1].

Individual fairness is an attractive principle, but it has a difficulty: who determines the distance measure d? The question "who is similar?" is also a value judgment. Are two people with the same debt-to-income ratio similar, or does one person's irregular income make them different? Individual fairness does not remove the problem; it moves it to the choice of d. Moreover, the condition limits not the score itself but only the differences between scores. A model that gives everyone 0 also satisfies the condition. For this reason individual fairness is a constraint to be considered together with an accurate model.

11.2.10Common mistakes in computing the criteria

Common mistake
  • Confusing TPR with PPV: Both have TP in the numerator, but the denominators differ. In TPR the denominator is those who repay (TP + FN); in PPV it is those approved (TP + FP). In group B, TPR = 16/32 = 0.5 and PPV = 16/20 = 0.8.
  • Writing FN in the denominator of FPR: The denominator of FPR is the total of those who do not repay: FP + TN. In B it is 4/(4 + 64) = 4/68, not 4/20.
  • Taking a difference in the four-fifths rule: The rule asks for a ratio: smaller ÷ larger. The inverse ratio (larger ÷ smaller) is also wrong; the result 0.50/0.20 = 2.5 makes the rule look "satisfied".
  • Taking accuracy for fairness: In the example the accuracy of both groups is 80%, yet the TPRs are 0.8 and 0.5. Equal accuracy does not show that the errors are of the same kind or fall on the same people.
  • Checking calibration in aggregate: Calibration is checked separately within each group. A check made on the pooled data of the two groups can hide a systematic deviation in one of the groups.
  • Forgetting L in individual fairness: The allowed difference is L · d, not d.

11.3Incompatibility of the criteria

The model in the previous section satisfied predictive parity and calibration but did not satisfy equalized odds. The first thought that comes to mind is that a better model could satisfy all of them at once. But this thought is generally wrong. Because the criteria are derived from the same four numbers, they are tied to one another. If the base rates differ, then apart from a few extreme cases no model can satisfy them all at once. Results of this kind are called impossibility theorems.

11.3.1The Chouldechova identity

Chouldechova (2017) wrote the link among the criteria as a single equality. To derive the equality it suffices to express the confusion matrix of a group in terms of the base rate p, the TPR, and the FPR.

Theorem 11.1 (The Chouldechova identity)

In a group with base rate p, with 0 < p < 1 and PPV > 0,

FPR = p / (1 − p) · (1 − PPV) / PPV · TPR.

1. Writing the matrix cells with the rates. Let the group have n people. By the definition of the base rate, those who repay number p · n and those who do not repay number (1 − p) · n. Since TPR is the share of those who repay that are approved, TP = p · n · TPR. Since FPR is the share of those who do not repay that are approved, FP = (1 − p) · n · FPR.

2. Substituting into PPV. PPV = TP / (TP + FP). Substituting the two expressions and canceling the common n in the numerator and denominator gives PPV = p · TPR / (p · TPR + (1 − p) · FPR).

3. Multiplying by the denominator. Multiply both sides by the denominator: PPV · [p · TPR + (1 − p) · FPR] = p · TPR. Expand the left side and move the term PPV · p · TPR to the right: (1 − p) · FPR · PPV = p · TPR − p · TPR · PPV = p · TPR · (1 − PPV).

4. Isolating FPR. Divide both sides by (1 − p) · PPV; this number is not zero because p < 1 and PPV > 0. The result is FPR = p/(1 − p) · (1 − PPV)/PPV · TPR. □

The identity ties the three rates (FPR, TPR, PPV) and the base rate together. If any three of them are known, the fourth can be computed. The numbers of the example model also follow this link.

Example 11.8
  1. Group A: p = 0.5, PPV = 0.8, TPR = 0.8. The factors: p/(1 − p) = 0.5/0.5 = 1; (1 − PPV)/PPV = 0.2/0.8 = 0.25. Result: FPR = 1 · 0.25 · 0.8 = 0.20 ✓ (same as in the table).
  2. Group B: p = 0.32, PPV = 0.8, TPR = 0.5. The factors: 0.32/0.68 = 8/17 ≈ 0.471; 0.25. Result: FPR = (8/17) · 0.25 · 0.5 = 1/17 = 4/68 ≈ 0.059 ✓.
  3. Interpretation: PPV is equal in the two groups (0.8), so the middle factor (1 − PPV)/PPV is 0.25 in both. But the factor p/(1 − p) is 1 in A and 0.471 in B.

The real question is this: when PPV is equal, can TPR and FPR be equal as well? Let PPV and TPR be equal in the two groups. Then on the right-hand side of the identity only the factor p/(1 − p) varies from group to group. If p differs, this factor differs as well (because p/(1 − p) increases strictly as p grows). As a result the FPRs come out different. For both the TPRs and the FPRs to be equal, the right-hand sides can be equalized only in extreme cases such as TPR = 0 or PPV = 1. PPV = 1 is the case in which everyone approved repays, that is, there is no false positive at all; TPR = 0 is the case in which nobody is given credit.

Theorem 11.2 (Incompatibility of predictive parity and equalized odds)

If the base rates of the two groups differ (pA ≠ pB), predictive parity and equalized odds cannot hold together, except in extreme cases such as having no false positives at all (FPR = 0 and PPV = 1; perfect prediction is a special case of this), approving nobody, or none of those approved repaying (PPV = 0).

Let predictive parity and equalized odds hold together: PPVA = PPVB = P, TPRA = TPRB = T, FPRA = FPRB. Write the identity for the two groups and equate the FPRs: pA/(1 − pA) · (1 − P)/P · T = pB/(1 − pB) · (1 − P)/P · T. If (1 − P)/P · T is not zero, divide both sides by it, and what remains is pA/(1 − pA) = pB/(1 − pB). Since this function is strictly increasing, we get pA = pB, which contradicts the assumption. So (1 − P)/P · T = 0 must hold, that is, either P = 1 or T = 0. In both cases the identity gives FPR = 0. □

What the theorem says is not a model defect but an arithmetic fact. However much data is collected and however sophisticated an algorithm is used, as long as the base rates differ and prediction is imperfect, choosing one criterion means giving up another.

Example 11.9

Suppose that in a group p = 0.2, PPV = 0.5, TPR = 0.6 are given. What is FPR?

  1. p/(1 − p) = 0.2/0.8 = 0.25.
  2. (1 − PPV)/PPV = 0.5/0.5 = 1.
  3. FPR = 0.25 · 1 · 0.6 = 0.15.

For a check, a group of 100 people can be set up: 20 repay, 80 do not. TP = 20 · 0.6 = 12, FP = 80 · 0.15 = 12. PPV = 12/24 = 0.5 ✓.

11.3.2What if we force equalized odds?

To see concretely what the incompatibility means, let us go in the opposite direction. Suppose there is a hypothetical, better-discriminating model for group B that gives the same error rates as for A. In this model TPRB = 0.8 and FPRB = 0.2. The current model, because it gives only the scores 0.8 and 0.2, cannot reach these two error rates together by changing the threshold or by approving at random. We do not need to know how the new model reaches these rates; the confusion matrix can be computed from the error rates alone.

Example 11.10
  1. Target: in B, TPR = 0.8 and FPR = 0.2 (the same as A). In B, 32 people repay and 68 do not.
  2. The rows of the matrix: once the error rates are fixed, the top and bottom rows of the confusion matrix are determined. TP = 32 × 0.8 = 25.6; FP = 68 × 0.2 = 13.6. These are expected numbers, so they can be fractional.
  3. Selection rate: approved = 25.6 + 13.6 = 39.2 people ⇒ selection rate ≈ 0.39. In B the approval rate rises from 0.20 to 0.39.
  4. PPV: PPVB = 25.6/39.2 ≈ 0.65. In A, PPV was 0.80. The repayment rate of those approved falls in B.

Equalized odds was achieved, but predictive parity was broken: an "approve" in B now conveys a lower probability of repayment. Since the model gives only approve/reject, the criterion that breaks is PPV.

The result can also be found with the identity. Writing 0.2 = (8/17) · (1 − PPV)/PPV · 0.8 for B gives (1 − PPV)/PPV = 0.2 · 17/(8 · 0.8) = 0.53125 and PPV = 1/1.53125 ≈ 0.653. The two routes give the same result.

Mathematics does not answer the question of which criterion should be preserved. The answer depends on the context: which harm is heavier (rejecting someone who could repay, or putting someone who cannot repay into debt), and what the law requires. Giving credit to someone who cannot repay can also harm them; a loan that is not repaid ruins the person's credit history. For this reason the conclusion "more approvals are always fairer" does not follow either.

11.3.3Calibration and balance: Kleinberg's theorem

The Chouldechova identity is for approve/reject decisions. Kleinberg, Mullainathan, and Raghavan (2017) studied the same problem at the level of scores. At the score level, the counterpart of equalized odds is balance.

Definition 11.8

Balance for the positive class: the average score of those who actually repay (Y = 1) is equal across groups. Balance for the negative class: the average score of those who actually do not repay (Y = 0) is equal across groups.

The meaning of balance for the positive class is similar to that of TPR equality: people in the same actual situation (those who repay) should receive the same score on average. The difference is that it looks at the score instead of the decision.

Example 11.11
  1. A, those who repay (Y = 1): of the 50 who repay, 40 received 0.8 and 10 received 0.2. The average is (40 · 0.8 + 10 · 0.2)/50 = (32 + 2)/50 = 0.68.
  2. B, those who repay: of the 32 who repay, 16 received 0.8 and 16 received 0.2. The average is (16 · 0.8 + 16 · 0.2)/32 = (12.8 + 3.2)/32 = 0.50. In our calibrated model, the members of B who repay get a lower score on average: no balance for the positive class.
  3. A, those who do not repay (Y = 0): of the 50 who do not repay, 10 received 0.8 and 40 received 0.2. The average is (10 · 0.8 + 40 · 0.2)/50 = (8 + 8)/50 = 0.32.
  4. B, those who do not repay: of the 68 who do not repay, 4 received 0.8 and 64 received 0.2. The average is (4 · 0.8 + 64 · 0.2)/68 = (3.2 + 12.8)/68 = 16/68 ≈ 0.235. There is no balance for the negative class either.

Although calibration holds, both balances are broken.

Theorem 11.3 (Kleinberg, Mullainathan, Raghavan, 2017)

For a risk score, calibration within groups, balance for the positive class, and balance for the negative class can hold together in only two cases: if the prediction is perfect (every person gets a score of 0 or 1 and the score equals their actual outcome) or if the groups' base rates are equal.

The full proof of the theorem is long, but its main idea can be seen from the observation in 11.2.6. In a calibrated model the average score of a group equals its base rate. This average is the weighted average of the average of those who repay and the average of those who do not repay: p = p · (average of those who repay) + (1 − p) · (average of those who do not repay). If both balances hold, the two averages in parentheses are the same in the two groups; call these two numbers x and y. Then for each group p = p · x + (1 − p) · y, that is, p · (1 − x + y) = y must hold. If 1 − x + y is not zero, this equality ties p to a single value, and the base rates of the two groups come out equal. If the base rates differ, what remains is 1 − x + y = 0; this is possible only with y = 0 and x = 1, that is, with perfect prediction (since the average scores lie between 0 and 1, x − y = 1 happens only this way). In our example the base rates differ (0.5 and 0.32) and the prediction is not perfect; the conflict of the criteria is unavoidable.

11.3.4Is this model fair? The answer depends on the criterion

When the computations are put together, it turns out that the question "Is this model fair?" has no single answer. Two tables summarize the whole situation.

Table 11.6: The example model's decisions in the two groups (100 applicants in each group, the same model, the same threshold 0.5).
groupapprove: repay / defaultreject: repay / defaultbase rate
A40 / 1010 / 400.50
B16 / 416 / 640.32
Table 11.7: The result under three criteria.
CriterionABSatisfied?
Demographic parity (approval rate)0.500.20no
Equalized odds (TPR; FPR)0.80; 0.200.50; 0.059no
Predictive parity (PPV)0.800.80yes

The model is fair by the institution's criterion and not fair by the applicant's criteria. Because the base rates differ (0.50 and 0.32), equalized odds and predictive parity cannot hold together except in extreme cases; demographic parity does not hold even under perfect prediction, because the approval rates would then equal the base rates (Chouldechova, 2017; Kleinberg et al., 2017). Which criterion to choose is a value decision. Leaving this decision to developers as if it were a technical detail is also a choice. Who makes the decision, and whether its rationale is written down, are matters for the auditing described in 11.5.4.

11.3.5A real case: the COMPAS debate

COMPAS is a risk assessment tool used in some courts in the United States. It scores a defendant's risk of reoffending within two years. In 2016 the news organization ProPublica examined the tool using data it obtained from Broward County, Florida (Angwin et al., 2016).

%0%25%504.2.FPRfalse "high risk"284.FNRfalse "low risk"Blackwhite
Figure 11.7: Error rates (percent) computed by ProPublica (2016) from the Broward County data. FPR: the share of defendants who did not reoffend but were labeled "high risk" (Black 44.9%, white 23.5%). FNR: the share of those who did reoffend but were labeled "low risk" (Black 28.0%, white 47.7%).

The two sides looked at two different criteria:

  • ProPublica: 44.9% of Black defendants who did not reoffend had been labeled "high risk"; among white defendants this rate was 23.5%. So the FPR was not equal. For the false negative rate (FNR) the picture reversed: 47.7% of white defendants who did reoffend had been called "low risk", compared with 28.0% of Black defendants. On the basis of these findings, ProPublica argued that the tool was biased against Black defendants.
  • Northpointe (the company that developed the tool): The same risk score corresponded to a similar reoffending rate in the two groups. That is, the tool was calibrated and satisfied predictive parity. On this ground the company argued that the tool was fair.

Both sides were right in their own computation. Because the base rates in the two groups' reoffending records differ, the two criteria could not hold together (the Chouldechova identity in Theorem 11.1). The debate is really about which definition of fairness to choose. Chouldechova's 2017 paper was written precisely in response to this debate. The lesson is this: instead of a single accuracy score, group-wise error rates should be reported. And when one side says "the model is fair", the first question to ask should be "by which criterion?".

The structure of the case is very similar to the chapter's numerical example. In COMPAS, the group with the higher base rate (the group whose reoffending rate looks higher in the records) also has the higher FPR. This is the direction the identity predicts: when PPV is equal, FPR grows as p grows. In the chapter's example, group A, which has the higher base rate, has an FPR (0.20) larger than B's (0.059).

11.3.6The fairness–accuracy trade-off

Model accuracy alone does not show on whom the errors are concentrated. In our example the accuracy is 80% in both groups, yet the TPRs are 0.8 and 0.5. Accuracy sums two kinds of errors (FP and FN) and erases the difference between them.

Adding a fairness constraint can increase the total error. This is a trade-off: giving up one thing to gain another. But the real choice is subtler than the question "how much accuracy is sacrificed?". The real choice is which errors are acceptable: a wrong rejection or a wrong approval? The same total error can be distributed differently among groups.

A fairness constraint can be added at three points in the development process of a model:

Pre-processing
The data are changed before the model is trained. For example, the examples of an underrepresented group are given more weight, or more data are collected from that group. The aim is to remove the underrepresentation.
In-processing
A fairness constraint or penalty term is added to the error measure minimized in training, that is, to the loss function. The model tries both to make few errors and to keep the group rates close; to do so it gives up some accuracy.
Post-processing
Without changing the scores of the trained model, the threshold that makes the decision is adjusted by group (Hardt et al., 2016). This method is simple, but because it explicitly uses group membership in the decision, it can be contested under some legal systems.

Which method and which criterion to choose should be guided by the context of use, legal requirements, regulations, and the views of the affected groups. For example, a credit scoring system that wants to evaluate low-income applicants fairly may count the rejection of members of this group who could repay (low TPR) as the gravest error and give priority to equal opportunity.

11.3.7Code trace: equal opportunity by randomization

The simplest form of post-processing is this: in group B, instead of approving only those with a score of 0.8, also approve some of those with a score of 0.2 at random. Let the probability of approval be q. The function below computes group B's TPR, FPR, and accuracy for each value of q.

def group_b(q):   # approve score 0.2 w.p. q
  TP = 16 + 16 * q
  FP = 4 + 64 * q
  tpr = TP / 32
  fpr = FP / 68
  hits = TP + (68 - FP)    # TP + TN
  return tpr, fpr, round(hits / 100, 3)

for q in [0, 0.2, 0.4, 0.6]:
  tpr, fpr, d = group_b(q)
  print(q, round(tpr, 2), round(fpr, 2), d)

The logic of the function comes from Table 11.2. All 20 people with a score of 0.8 are approved; of these 16 repay (TP) and 4 do not (FP). Each of the 80 people with a score of 0.2 is approved with probability q. Of these 80, 16 repay and 64 do not. In expectation, 16 · q of those who repay and 64 · q of those who do not repay receive an additional approval. Thus TP = 16 + 16q and FP = 4 + 64q. The denominator of TPR is all of those in B who repay (32), and that of FPR is all of those who do not repay (68). The correct decisions are the sum of TP and TN; TN is those who do not repay and are not approved: TN = 68 − FP. In the code the line hits = TP + (68 - FP) does this. So the accuracy is (16 + 16q + 68 − 4 − 64q)/100 = (80 − 48q)/100.

Table 11.8: Trace of group_b(q). The last two columns are the selection rate and PPV, which are not computed in the code but follow from the same numbers.
qTPFPTPRFPRaccuracyselection ratePPV
01640.50.060.8000.200.80
0.219.216.80.60.250.7040.360.53
0.422.429.60.70.440.6080.520.43
0.625.642.40.80.620.5120.680.38

The table is read row by row as follows:

  1. q = 0: Only those with 0.8 are approved (today's model). TP = 16, FP = 4. TPR = 16/32 = 0.5; FPR = 4/68 ≈ 0.06; accuracy (16 + 64)/100 = 0.80.
  2. q = 0.2: 20% of the 80 people with 0.2 are approved. TP = 16 + 16 · 0.2 = 19.2; FP = 4 + 64 · 0.2 = 16.8. TPR rises to 0.6 but accuracy falls to 0.704. Why does it fall so much? Only 20% of those with 0.2 repay; of every 5 newly approved people, 4 are among those who will not repay.
  3. q = 0.4: TP = 22.4; FP = 29.6. TPR 0.7; FPR jumps to 0.44; accuracy 0.608.
  4. q = 0.6: TP = 25.6; FP = 42.4. TPRB = 25.6/32 = 0.8 = TPRA: equal opportunity is achieved. The price: accuracy fell to 0.512 and PPV to 0.38; FPR rose to 0.62.
0..1q=0q=.q=.q=.TPR_Aq = .TP = 25.6 FP = 42.4TPR_B = .FPR_B = .2accuracy_B = 0.512
Figure 11.8: The effect of approving those with 0.2 at random with probability q in group B. Blue: TPRB (rises from 0.5 to 0.8 and reaches A's TPR, the dashed line, at q = 0.6). Red: FPRB (from 0.06 to 0.62). Green: B's accuracy (from 0.8 to 0.512).

Figure 11.8 shows the price plainly. For equal opportunity, 60% of those with 0.2 have been approved at random. Of the 64 who will not repay, about 64 · 0.6 ≈ 38 receive credit. B's FPR (0.62) is more than three times A's (0.2); so equalized odds still does not hold. Predictive parity is broken as well: PPV has fallen from 0.80 to 0.38. It is possible to achieve one criterion by randomization, but this does not increase the model's power to discriminate; it only redistributes the errors.

Example 11.12

If A's TPR were 0.7 instead of 0.8, what would q have to be for equal opportunity in B, and what would B's accuracy be?

  1. TPRB = (16 + 16q)/32 = 0.5 + 0.5q.
  2. 0.5 + 0.5q = 0.7 ⇒ 0.5q = 0.2 ⇒ q = 0.4.
  3. Accuracy (80 − 48 · 0.4)/100 = (80 − 19.2)/100 = 0.608. It is the same as the q = 0.4 row of Table 11.8.
Common mistake
  • "A better model satisfies all the criteria." When base rates differ, this happens only with perfect prediction. Improving the model can reduce the size of the conflict but does not remove it.
  • Writing p instead of p/(1 − p) in the identity: The factor is not a probability but an odds ratio ("the ratio of those who repay to those who do not"). At p = 0.5 it is 1, not 0.5.
  • Looking for the price of randomization only in accuracy: As q grows, accuracy falls, but the really important change is the change in FPR and PPV. While one criterion is achieved, the others can move even further away.
  • Confusing balance with calibration: Calibration asks "what is the actual outcome of people whose score is known?"; balance asks "what is the score of people whose actual outcome is known?". The direction of the condition is reversed.

11.4Fair division

The second face of fairness is the distribution of a common resource among people. Dividing an inheritance, distributing the processing time of a shared machine among users, parceling out a piece of land, or assigning courses to students are problems of this kind. What is measured here is not a model's error rates but what each person receives in their own eyes. The resource can be divisible (a cake) or consist of indivisible goods; the notions of fairness and the algorithms that achieve them differ in the two cases.

11.4.1The cake-cutting model

A divisible resource is traditionally described by a cake. The cake is the interval [0, 1] on the number line. This interval can represent time (the hours of a day), land (a stretch of coast), or processing time. The cake is to be divided among n people.

People value different parts of the cake differently. One likes the chocolate part, another the vanilla part; one wants the morning hours, another the evening hours. This difference is described by a value function.

Definition 11.9

In the cake-cutting problem, each person i has a value function vi. vi(X) is the value of piece X in the eyes of person i. The whole cake is worth 1 to every person: vi([0, 1]) = 1. Values are additive: the value of the union of two disjoint pieces is the sum of their values. Xi is the piece that person i receives.

An algorithm does not know people's value functions in full; knowing them would mean an infinite amount of information. Instead it asks people questions. In the standard model proposed by Robertson and Webb there are two kinds of question:

  • Evaluation query: "What value do you give the piece [a, b]?"
  • Cut query: "Where does the piece that starts at a and has value α in your eyes end?"

This model is called the Robertson–Webb query model. The efficiency of an algorithm is measured by how many queries it asks. This measure is like counting how many comparisons an algorithm makes in computer science.

There are two basic ways of saying that an allocation is "fair".

Definition 11.10

An allocation (X1, …, Xn) is:

  • proportional if everyone receives at least 1/n in their own eyes: vi(Xi) ≥ 1/n for every i;
  • envy-free if nobody prefers another's piece to their own: vi(Xi) ≥ vi(Xj) for every i and j.

In both definitions the evaluation is made with each person's own value function. That is, fairness is defined not by an outside referee but by the people's own preferences. Ali and Ayşe can receive pieces of different sizes from the same cake, and the allocation can still be fair in both their eyes.

Proportionality is a "lower bound" condition: the person looks only at their own share. Envy-freeness is a "comparison" condition: the person compares their own share with everyone else's. When the cake is fully allocated, envy-freeness implies proportionality. The reason is simple: an envy-free person finds their own piece at least as valuable as each of the n pieces; since the total value of the n pieces is 1 in their eyes, the value of the largest piece is at least 1/n. The reverse is generally not true (11.4.5).

From the viewpoint of game theory, people may be strategic: they may try to get a bigger piece by giving false answers to the algorithm's questions. A good protocol gives every person who behaves honestly a guarantee, whatever the others do. This guarantee is stronger than a notion like the Nash equilibrium, which assumes that everyone is rational. A person can secure their share without making any assumption about the others' behavior.

11.4.2Cut and choose step by step

For two people, the oldest known fair division method is the rule children use when sharing a cake: one cuts, the other chooses.

Definition 11.11

The cut-and-choose method consists of two steps:

  1. The cutter divides the cake into two pieces of equal value in their own eyes.
  2. The chooser takes whichever of the two pieces has the greater value in their own eyes; the remaining piece goes to the cutter.

The example cake consists of two halves: the left half [0, 0.5] is vanilla and the right half [0.5, 1] is chocolate. Ali values every part of the cake equally. Ayşe likes chocolate 3 times as much as vanilla: vAyşe(vanilla) = 1/4, vAyşe(chocolate) = 3/4. Within each half the value is spread uniformly; that is, half of a half is worth half the value of that half.

Example 11.13
  1. Ali cuts. He makes two equal pieces in his own eyes. Since Ali's value is uniform, he cuts at x = 1/2. Each piece is worth 1/2 to Ali.
  2. Ayşe evaluates. The left piece is pure vanilla, so in her eyes it is 1/4; the right piece is pure chocolate, so it is 3/4.
  3. Ayşe chooses. She takes the piece with the greater value, the right one (chocolate). The left piece goes to Ali.
  4. Result. Proportionality: Ali 1/2 ≥ 1/2, Ayşe 3/4 ≥ 1/2 ✓. Envy-freeness: Ali values his own piece at 1/2 and Ayşe's at 1/2 (1/2 = 1/2, he does not envy); Ayşe values her own piece at 3/4 and Ali's at 1/4 (3/4 > 1/4) ✓.
vanilla [0, 0.5]chocolate [0.5, 1]cut x = 0.5Ali: 1/2Ali: 1/2Ayşe: 1/4Ayşe: 3/4
Figure 11.9: Cut and choose, with Ali cutting. The cut is at x = 0.5. The left piece is worth 1/2 to Ali and 1/4 to Ayşe; the right piece is worth 1/2 to Ali and 3/4 to Ayşe. Ayşe chooses the right one.

If the roles are swapped, the result changes too. This time let Ayşe cut and Ali choose. Ayşe must make two equal pieces in her own eyes. Since the whole left half (vanilla) is worth only 1/4 to her, the cut must be inside the chocolate. If the cut point is x > 1/2, the value of the left piece to Ayşe is 1/4 + (3/4) · (x − 1/2)/(1/2) = 1/4 + 1.5 · (x − 1/2). Setting this equal to 1/2 gives 1.5 · (x − 1/2) = 1/4, that is, x − 1/2 = 1/6 and x = 2/3.

vanilla [0, 0.5]chocolate [0.5, 1]cut x = 0.667Ali: 2/3Ali: 1/3Ayşe: 1/2Ayşe: 1/2AliAyşe
Figure 11.10: When the roles are swapped: Ayşe cuts at x = 2/3 ≈ 0.667 (1/2–1/2 in her own eyes). Ali chooses the left piece and receives 2/3 in his own eyes; Ayşe receives 1/2.

In Figure 11.10 Ali's choice is easy: the left piece is worth 2/3 to him and the right piece 1/3. Ali gets 2/3, and Ayşe gets exactly 1/2 in her own eyes. Looking at the two cases together, a pattern appears: Ali gets 2/3 when choosing and 1/2 when cutting; Ayşe gets 3/4 when choosing and 1/2 when cutting. The chooser is better off than the cutter. The cutter receives only the guarantee (1/2); the chooser collects the gain from the difference between the two people's valuations.

11.4.3Code trace: a cut query by bisection

We found Ayşe's cut point (2/3) above with a formula. An algorithm, however, does not know the formula of Ayşe's value function; it can only ask Robertson–Webb queries. The answer to a cut query can be found approximately, using only evaluation queries, by the bisection method. The code below implements this idea.

def v_ayse(x):          # value of [0, x]
  if x <= 0.5: return x / 2
  return 0.25 + 1.5 * (x - 0.5)
def cut_point(v, target, steps):
  lo, hi = 0.0, 1.0
  for _ in range(steps):
    mid = (lo + hi) / 2
    if v(mid) < target: lo = mid
    else: hi = mid
  return (lo + hi) / 2
print(round(cut_point(v_ayse, 0.5, 8), 3))

v_ayse(x) gives the value of the piece [0, x] to Ayşe. When x ≤ 0.5 the piece is entirely vanilla and its value is x/2 (all the vanilla, that is, length 0.5, is worth 1/4). When x > 0.5, all the vanilla (0.25) plus part of the chocolate is taken; each unit of length of chocolate is worth (3/4)/(1/2) = 1.5.

The function cut_point(v, target, steps) knows that the point it is looking for lies in the interval [lo, hi]. At the start lo = 0 and hi = 1. At each step it asks about the middle of the interval. If the value at the middle is less than the target, the cut point is further to the right and lo moves to the middle; otherwise the cut point is at the middle or to its left and hi moves to the middle. Each step halves the interval. For this method to work it suffices that the value function is non-decreasing: the value of [0, x] does not decrease as the piece grows.

Table 11.9: Trace of cut_point(v_ayse, 0.5, 8). Each row is one evaluation query.
querymidv(mid)comparisonnew [lo, hi]width
10.50.25< 0.5 ⇒ lo = mid[0.5, 1]1/2
20.750.625≥ 0.5 ⇒ hi = mid[0.5, 0.75]1/4
30.6250.4375< 0.5 ⇒ lo = mid[0.625, 0.75]1/8
40.68750.5312≥ 0.5 ⇒ hi = mid[0.625, 0.6875]1/16
50.65620.4844< 0.5 ⇒ lo = mid[0.6562, 0.6875]1/32
60.67190.5078≥ 0.5 ⇒ hi = mid[0.6562, 0.6719]1/64
70.66410.4961< 0.5 ⇒ lo = mid[0.6641, 0.6719]1/128
80.6680.502≥ 0.5 ⇒ hi = mid[0.6641, 0.668]1/256

After eight queries the width of the interval is 1/28 = 1/256. The function returns the middle of the interval, ≈ 0.666. The true cut is 2/3 ≈ 0.6667; the error is about 0.00065. If Ayşe were the cutter, she would cut here.

vanilla (Ayşe: 1/4)chocolate (Ayşe: 3/4)0.1lo=.641hi=.68cut ≈ 0.666 (exact value 2/3)
Figure 11.11: After eight queries the search interval narrows to [0.6641, 0.668]; the midpoint is ≈ 0.666 and the true cut is 2/3.

How the error shrinks can be written in general. After k queries the width of the interval is 2−k. The true point lies inside this interval and the function returns the middle of the interval; so the error is at most half the interval, that is, 2−(k+1). For the error always to stay below 0.001 we need 2−(k+1) < 0.001. Since 210 = 1024 > 1000, k + 1 = 10, that is, k = 9 queries suffice; at k = 8 the bound is 2−9 ≈ 0.00195 and gives no guarantee. For one more decimal digit of accuracy, about three or four more queries are needed.

Example 11.14

When cut_point(v_ayse, 0.5, 3) is called, what is [lo, hi] at the end of the loop?

  1. Mid 0.5: v = 0.25 < 0.5 ⇒ lo = 0.5.
  2. Mid 0.75: v = 0.625 ≥ 0.5 ⇒ hi = 0.75.
  3. Mid 0.625: v = 0.4375 < 0.5 ⇒ lo = 0.625.

The interval is [0.625, 0.75] and the returned value is 0.6875. This is the same as the first three rows of Table 11.9.

11.4.4Why is cut and choose fair?

The reason cut and choose is fair becomes clear when one looks at the guarantees of the two roles separately.

The cutter's guarantee. The cutter does not know which piece they will end up with; the chooser takes whichever they want. If the cutter thinks of the worst case, they are left with the smaller of the two pieces. So the cutter's guarantee is min(v(left), v(right)). As the cut point moves to the right, the value of the left piece rises and that of the right piece falls; the smaller of the two values is largest when the two are equal. This point is exactly the cutter's own halfway point, and the guarantee is 1/2. Cutting honestly, that is, making two equal pieces, is the strategy that maximizes the worst-case gain, the maximin strategy.

0.5.01/22/31cut point xcutter's guarantee: min(v(left), v(right))Ali: x = 1/2Ayşe: x = 2/3
Figure 11.12: The cutter's guarantee min(v(left), v(right)) as a function of the cut point x. For Ali (blue) the peak is at x = 1/2, for Ayşe (red) at x = 2/3; both peaks have height 0.5.

Figure 11.12 shows this "roof" shape. Ali's curve is smooth, because his value is spread uniformly. The left arm of Ayşe's curve rises slowly up to 1/2 (vanilla is of little value) and then rises fast. The peak of both curves is 0.5: whatever anyone's value function is, an honest cutter guarantees 1/2.

The chooser's guarantee. The chooser takes the larger of the two pieces in their own eyes. Since the values of the two pieces sum to 1, the larger is at least 1/2. Moreover, the piece they choose is not less valuable than the remaining piece. These two properties hold however the cut is made; even if the cutter does not behave honestly, the chooser receives a share that is both proportional and envy-free.

The value of information. If the cutter knows the chooser's preference, they can shift the cut accordingly and receive more than 1/2; but their guarantee is still 1/2. The example below shows this with numbers.

Example 11.15

Ali cuts, and he knows that Ayşe likes chocolate 3 times as much. If Ayşe finds the two pieces equally valuable, she chooses the chocolate (right) piece. Where does Ali cut, and what does he gain in his own eyes?

  1. Ayşe chooses the right piece as long as the value of the left piece in her eyes is at most 1/2.
  2. If the cut is at x ≥ 1/2, the value of the left piece to Ayşe is 1/4 + 1.5 (x − 1/2). The condition 1/4 + 1.5 (x − 1/2) ≤ 1/2 means x ≤ 2/3.
  3. Since Ali wants to take the left piece, he makes it as large as possible: he cuts at x = 2/3.
  4. Ali receives 2/3 > 1/2 in his own eyes; Ayşe again receives 1/2.

Information gives the cutter an advantage. But if Ali's information is wrong (for example, if Ayşe actually likes vanilla), this shifted cut can drop Ali below 1/2. The value of the honest cut is that it gives a guarantee that requires no information.

That cut and choose is both proportional and envy-free for two people is not a coincidence; for two people these two notions are the same.

Theorem 11.4 (Proportionality and envy-freeness for two people)

If the cake is fully divided between two people, then for one person proportionality and envy-freeness are equivalent: v(X1) ≥ 1/2 ⇔ v(X1) ≥ v(X2).

Since the cake is fully divided, v(X1) + v(X2) = 1. (⇒) Let v(X1) ≥ 1/2. Then v(X2) = 1 − v(X1) ≤ 1/2 ≤ v(X1); the person does not envy the other. (⇐) Let v(X1) ≥ v(X2) = 1 − v(X1). Adding v(X1) to both sides gives 2 v(X1) ≥ 1, that is, v(X1) ≥ 1/2. □

For three or more people this equivalence breaks down: envy-freeness still implies proportionality, but a proportional allocation can contain envy. Envy-freeness becomes the stronger condition.

11.4.5Proportional but not envy-free: a three-person example

Three people (Ali, Ayşe, Cem) will share three pieces of a cake (X, Y, Z) that have already been cut. The table below shows the value each person gives to each piece; every row sums to 1.

Table 11.10: The values three people give to three pieces, and the allocation Ali → X, Ayşe → Y, Cem → Z.
personpiece Xpiece Ypiece Zreceives≥ 1/3?
Ali0.400.300.30X: 0.40yes
Ayşe0.200.350.45Y: 0.35yes
Cem0.300.300.40Z: 0.40yes
Example 11.16
  1. Proportionality. 1/3 ≈ 0.333. Ali receives 0.40, Ayşe 0.35, Cem 0.40; all three are above 0.333. The allocation is proportional.
  2. Ali's envy. For Ali, Y and Z are 0.30 and his own X is 0.40. Ali envies nobody.
  3. Cem's envy. For Cem, X and Y are 0.30 and his own Z is 0.40. Cem envies nobody.
  4. Ayşe's envy. For Ayşe, Cem's piece Z is worth 0.45 and her own Y is worth 0.35. 0.45 > 0.35: Ayşe envies Cem.

The allocation is proportional but not envy-free. Since Ayşe receives more than 1/3, she cannot say "I was treated unfairly", but she would like to swap with Cem.

There is a simple fix in this example: if Ayşe and Cem swapped pieces, Ayşe would get 0.45 and Cem would get 0.30. But this time Cem would fall below 1/3 and the allocation would no longer be proportional. Finding an envy-free allocation is generally much harder than finding a proportional one. This difference is reflected in the complexity of the known algorithms:

Last diminisher
Finds a proportional allocation for n people (11.4.6).
Selfridge–Conway
Finds an envy-free allocation for 3 people, with at most 5 cuts.
Aziz–Mackenzie (2016)
The first algorithm that finds an envy-free allocation for n people and terminates after a finite number of queries. But the upper bound on the number of queries is enormous; it is a function of n that grows like a tower of exponents. The algorithm is important in theory and is not used in practice.

11.4.6Last diminisher

One way to extend cut and choose to more than two people is to put the first piece through everyone's inspection. This idea leads to the last diminisher method.

Definition 11.12

The last diminisher method works for n people as follows:

  1. The first person cuts, from the left of the cake, a piece worth 1/n in their own eyes.
  2. The piece is shown to the other people in turn. A person who finds the piece worth more than 1/n in their own eyes trims it (diminishes it) so that it is worth exactly 1/n in their own eyes. A person who finds the piece worth 1/n or less does not touch it ("passes").
  3. The person who trimmed the piece last takes it and leaves the game. If nobody trimmed, the piece goes to the first cutter.
  4. The remaining cake is divided among the remaining n − 1 people with the same method. When two people remain, cut and choose is applied.

To see why the method is proportional it suffices to look at two kinds of people. The person who takes the piece is the one who trimmed it last; in their own eyes they receive exactly 1/n. For those who do not take the piece, the piece is worth at most 1/n in their eyes: either it was so from the start or they trimmed it to make it so (if someone after them trimmed it, the piece became even smaller). So the remaining cake is worth at least 1 − 1/n = (n − 1)/n to them. If the remaining n − 1 people divide this cake proportionally, each receives at least ((n − 1)/n) · (1/(n − 1)) = 1/n.

In the example there are three people and the cake is divided into four equal quarters. Within each quarter the value is spread uniformly. Ali's value is uniform; Ayşe likes the right side, and Cem likes the left.

Ali.5.5.5.5Ayşe....Cem....
Figure 11.13: The last diminisher example. The bars are each person's value per quarter (every row sums to 1): Ali 0.25–0.25–0.25–0.25; Ayşe 0.1–0.2–0.3–0.4; Cem 0.4–0.3–0.2–0.1.

A tool for the computations is this: since the length of a quarter is 1/4, in a quarter of value w a unit of length is worth 4w. For example, in Cem's first quarter a unit of length is worth 4 · 0.4 = 1.6; the piece [0, 0.1] is worth 0.1 · 1.6 = 0.16 to him.

Example 11.17
  1. Ali cuts. A piece worth 1/3 in his own eyes: [0, 1/3]. Since Ali's value is uniform, length and value are the same.
  2. Ayşe looks. The piece contains the whole first quarter (0.1) and a length of 1/3 − 1/4 = 1/12 from the second quarter. In the second quarter a unit of length is worth 4 · 0.2 = 0.8. The value is 0.1 + (1/12) · 0.8 = 0.1 + 0.0667 = 1/6. 1/6 < 1/3; Ayşe does not touch it.
  3. Cem looks. The value is 0.4 + (1/12) · 1.2 = 0.4 + 0.1 = 1/2. 1/2 > 1/3; Cem trims the excess. Since the first quarter alone is 0.4 > 1/3, the cut is inside the first quarter: 1.6 · x = 1/3 ⇒ x = 1/(3 · 1.6) = 5/24 ≈ 0.208. The piece is now [0, 5/24] and is worth exactly 1/3 in Cem's eyes.
  4. Cem takes it. Cem is the last to trim the piece; he takes it and leaves. For Ali, who did not trim, the piece is 5/24 ≤ 1/3, and for Ayşe it is (5/24) · 0.4 = 1/12 ≤ 1/3. The remaining cake is worth at least 2/3 in the eyes of both.
  5. Cut and choose between the two on the remainder [5/24, 1]. The remaining cake is worth 1 − 5/24 = 19/24 to Ali. Ali divides it into two equal pieces in his own eyes: half is 19/48, and the cut is at 5/24 + 19/48 = 10/48 + 19/48 = 29/48 ≈ 0.604.
  6. Ayşe chooses. The right piece [29/48, 1] for Ayşe: a length of 3/4 − 29/48 = 7/48 from the third quarter (unit value 1.2) and the whole fourth quarter (0.4). The value is (7/48) · 1.2 + 0.4 = 0.175 + 0.4 = 0.575 = 23/40. The left piece [5/24, 29/48] is worth 41/120 ≈ 0.342 to her. Ayşe chooses the right one.

Result: Cem receives [0, 5/24], worth 1/3 in his own eyes; Ali receives [5/24, 29/48], worth 19/48 ≈ 0.396; Ayşe receives [29/48, 1], worth 23/40 = 0.575. Everyone received at least 1/3 in their own eyes; the allocation is proportional.

piece [0, 1/3]Ali.5.5.5.5Ayşe....Cem....1/31/61/2 > 1/3
Figure 11.14: The piece [0, 1/3] cut by Ali (shaded area). The piece is worth 1/3 to Ali, 1/6 to Ayşe, and 1/2 to Cem. Cem pulls the cut in to 5/24 (orange line).
Cem's pieceAliAyşeAli.5.5.5.5Ayşe....Cem....19/48 ≥ 1/323/40 ≥ 1/31/3 ≥ 1/3
Figure 11.15: The outcome of the last diminisher. Cem receives [0, 5/24], Ali [5/24, 29/48], Ayşe [29/48, 1]. The numbers on the right are the value each person gives to their own piece: 19/48, 23/40, and 1/3; all ≥ 1/3.

Figure 11.15 shows that the allocation is proportional. But the allocation is not envy-free. Cem gives Ali's piece [5/24, 29/48] the following value: from the first quarter a length of 1/24 (unit 1.6) ⇒ 1/15; the whole second quarter ⇒ 0.3; from the third quarter a length of 5/48 (unit 0.8) ⇒ 1/12. The total is 1/15 + 3/10 + 1/12 = 9/20 = 0.45. Cem's own piece is 1/3 ≈ 0.333: Cem envies Ali. The last diminisher guarantees only proportionality.

The number of queries of the method can also be computed. In the first round a piece is shown to each of the n people; in the second round to n − 1 people, and so on. The total is about n + (n − 1) + … + 2 ≈ n²/2 queries; that is, O(n²).

Example 11.18

If Cem's values were like Ayşe's (0.1, 0.2, 0.3, 0.4), who would take the first piece?

Ali again cuts [0, 1/3]. For Ayşe this piece is 1/6 (the computation above). Since Cem's values are the same, it is 1/6 for him as well. Both find 1/6 < 1/3 and do not touch it. Since nobody trims, the piece goes to the first cutter, that is, Ali.

11.4.7Moving knife and Even–Paz

The last diminisher method also has a continuous version. Dubins and Spanier (1961) describe it with the image of a knife.

Definition 11.13

In the moving knife (Dubins–Spanier) method, a knife slides slowly from the left of the cake to the right. When the piece to the left of the knife reaches the value 1/n in someone's eyes, that person says "stop!", takes the piece, and leaves. The knife continues with the rest; the last person takes what remains.

Let us run the method with the values of the last diminisher example (per quarter: Ali 0.25; Ayşe 0.1–0.4; Cem 0.4–0.1). For each person the answer to "when does the left piece become worth 1/3?" is computed; the person with the smallest answer says "stop" first.

Table 11.11: The moving knife. Each cell is the knife position at which that person would say "stop".
personRound 1: v([0, x]) = 1/3Round 2: v([5/24, x]) = 1/3receives
Cemx = 5/24 ≈ 0.21 (stop!)—[0, 5/24]: 1/3
Alix = 1/3 ≈ 0.33x = 13/24 ≈ 0.54 (stop!)[5/24, 13/24]: 1/3
Ayşex = 19/36 ≈ 0.53x = 43/72 ≈ 0.60[13/24, 1]: 13/20
Example 11.19
  1. Round 1, Cem: In the first quarter the unit value is 1.6; 1.6 x = 1/3 ⇒ x = 5/24.
  2. Round 1, Ali: Uniform value; x = 1/3.
  3. Round 1, Ayşe: The first two quarters give her 0.1 + 0.2 = 0.3, which is less than 1/3. In the third quarter the unit value is 1.2: 0.3 + 1.2 (x − 1/2) = 1/3 ⇒ x − 1/2 = 1/36 ⇒ x = 19/36.
  4. The smallest position is Cem's (5/24). When the knife gets there, Cem stops it and takes [0, 5/24]. The first piece is the same as in the last diminisher: Cem stops the cut first.
  5. Round 2, Ali: 5/24 + 1/3 = 5/24 + 8/24 = 13/24.
  6. Round 2, Ayşe: [5/24, 1/4] gives her (1/24) · 0.4 = 1/60 and the second quarter gives 0.2; up to 1/2 the total is 13/60 ≈ 0.217. The shortfall 1/3 − 13/60 = 7/60 is made up in the third quarter with a length of (7/60)/1.2 = 7/72: x = 1/2 + 7/72 = 43/72.
  7. Ali's position (13/24 ≈ 0.542) is smaller than Ayşe's (43/72 ≈ 0.597). Ali stops the knife and takes [5/24, 13/24]. Ayşe takes the rest: [13/24, 1], whose value is (3/4 − 13/24) · 1.2 + 0.4 = (5/24) · 1.2 + 0.4 = 0.25 + 0.4 = 13/20.

Everyone receives at least 1/3; the allocation is proportional. It is not envy-free: Cem values Ali's piece [5/24, 13/24] at 1/15 + 0.3 + 1/30 = 2/5 > 1/3.

The moving knife is the "continuous-time" form of the last diminisher; to run it as an algorithm, each person's "stop" point is found with a cut query. In each round a cut query is asked of everyone remaining; the total number of queries is again O(n²). Even and Paz (1984) find a proportional allocation with far fewer queries, O(n log n), by dividing the cake in two at every step. The idea is this: everyone marks the halfway point of the cake in their own eyes; the cake is cut at the median of the marks; half of the people share the left piece and half the right piece among themselves with the same method. Since the group is halved at every step, there are about log2 n levels, and n queries are asked at each level.

11.4.8Indivisible goods: round-robin and EF1

A cake can be cut wherever one wants; but a car, a house, or a course seat is indivisible. With indivisible goods each item is given entirely to one person. The set of items a person receives is called a bundle. Values are assumed to be additive: the value of a bundle is the sum of the values of the items in it.

With indivisible goods, envy-freeness is not always possible. The simplest example is sharing a single car between two siblings. The sibling who gets the car does not envy the other, but the other, who gets nothing, envies the one with the car. Whichever allocation is chosen, someone envies. So a weakened notion of fairness is needed.

Definition 11.14

An allocation is envy-free up to one good (EF1) if, in every case of envy, removing a suitable item from the envied bundle eliminates the envy. That is, if i envies j, then for some g ∈ Xj we have vi(Xi) ≥ vi(Xj \ {g}).

Round-robin: the people go around in a fixed order, and in each turn each takes the most valuable remaining item in their own eyes.

EF1 means "even if there is envy, it stems from the luck of a single item". In the single-car example, if the car is removed from the bundle of the sibling who has it, an empty bundle remains; the other sibling's envy disappears. This allocation is EF1.

In the example there are two people and four items. Ali starts.

Table 11.12: Four indivisible items and the values of two people.
persong1g2g3g4
Ali7531
Ayşe8611
Example 11.20
  1. Ali takes g1 (7). Ali: own 7. Ayşe: own 0, Ali's bundle 8 in her eyes.
  2. Ayşe takes g2 (6) from the remaining. Ayşe: own 6, Ali's bundle 8. Ali: own 7, Ayşe's bundle 5.
  3. Ali takes g3 (3). Ali: own 10, Ayşe's bundle 5. Ayşe: own 6, Ali's bundle 8 + 1 = 9.
  4. Ayşe takes g4 (1). Ayşe: own 7, Ali's bundle 9. Ali: own 10, Ayşe's bundle 5 + 1 = 6.

Result: Ali {g1, g3} = 10, Ayşe {g2, g4} = 7. Ali does not envy (10 ≥ 6). Ayşe, however, values Ali's bundle at 9 and receives 7: she envies! But if g1 is removed from Ali's bundle, 1 remains in Ayşe's eyes and 1 ≤ 7: the allocation is EF1.

When values are non-negative and additive and each person, on their turn, chooses the item most valuable in their own eyes among those remaining, it can be shown that round-robin always produces an EF1 allocation. For two people the reason is short. Each of Ayşe's picks comes before Ali's next pick and takes the most valuable item remaining at that moment. So Ayşe's k-th pick is, in her eyes, worth no less than Ali's (k + 1)-th pick. When Ali's first pick (g1) is removed, the rest of Ali's items are matched one to one with Ayşe's items, and in each pair Ayşe values her own item at least as much as the other. In the example, Ayşe's g2 (6) is worth more than Ali's g3 (1 to Ayşe). The person who starts (Ali) never envies, because in every round he picks before the other.

Example 11.21

If Ayşe had started in the round-robin (with the same values), who would take what? If a person finds two items equally valuable, they take the one with the smaller number.

  1. Ayşe takes g1 (8).
  2. Ali takes g2 (5) from the remaining.
  3. For Ayşe, g3 and g4 are equal (1 and 1); she takes g3, the one with the smaller number.
  4. Ali takes g4 (1).

Ali {g2, g4} = 6, Ayşe {g1, g3} = 9. Ali values Ayşe's bundle at 7 + 3 = 10: he envies. But when g1 is removed, 3 remains and 3 ≤ 6: it is EF1 again. This time Ayşe, who starts, does not envy.

11.4.9Back to the game: greedy picking is not a best response

Let us return to the opening Fair Division Game (11.1.1). The values of the items (P1 / P2) are: Cake 5/1, Book 4/9, Headphones 3/8, Ball 1/1. P1 starts and P2 takes, in each round, the remaining item that is most valuable in its own eyes. Let us compare two plans for P1.

Table 11.13: P1's two plans and their outcomes.
P1's planPicking orderP1P2
always the most valuableCake, Book, Headphones, Ball810
Book firstBook, Headphones, Cake, Ball99
Example 11.22
  1. Plan 1 (greedy). P1 takes its most valuable item, the Cake (5). P2 takes the Book (9). From the remaining, P1 takes the Headphones (3) and P2 takes the Ball (1). P1: 5 + 3 = 8. P2: 9 + 1 = 10.
  2. Plan 2 (Book first). P1 takes the Book (4). From the remaining, P2 takes its most valuable item, the Headphones (8). P1 takes the Cake (5) and P2 takes the Ball (1). P1: 4 + 5 = 9. P2: 8 + 1 = 9.
  3. Why does it work? P2 gives the Cake a value of only 1; the Cake will not run away if it waits. What P2 really wants is the Book. If P1 takes the Book first, it takes P2's favorite item away, and it can still take the Cake in the next round.

When all the picking orders of the four items are tried, the largest value P1 can get against this P2 is 9; Plan 2 is the best response. In round-robin, taking the most liked item in every round is not always the best strategy.

Let us also look at what happens in terms of fairness. In the second plan, P2 values P1's bundle {Book, Cake} at 9 + 1 = 10; its own bundle {Headphones, Ball} is worth 9. P2 envies. If the Book is removed, 1 ≤ 9: the allocation is EF1 again. The guarantee from theory is this: if both sides always take their favorite, round-robin produces EF1. Once one side behaves strategically, this guarantee no longer comes from the theory; in this example EF1 still holds, but there is no guarantee that it will hold in every case.

This observation has also been seen in real life. Harvard Business School used to allocate courses to students with a method based on a round-robin draft. Budish and Cantillon (2012) studied the data of this system. Students made exactly this kind of strategic choice: they held back courses that were unpopular but valuable to themselves and moved up the courses that others also wanted. This behavior caused a loss of welfare. Even a fair protocol is open to strategic players: the EF1 guarantee holds if everyone takes their favorite when their turn comes.

11.4.10Three social welfare criteria

To choose among several allocations, one has to rank them with a number. This number is called a social welfare criterion. Three criteria are common.

Definition 11.15
  • Utilitarian welfare: the social welfare SW = Σ vi(Xi), that is, the sum of the values, is maximized. This criterion measures efficiency.
  • Egalitarian welfare: the smallest vi(Xi) is maximized (maximin). The share of the worst-off person is protected.
  • Nash social welfare: the product of the values Π vi(Xi) is maximized. For two people it is vAli × vAyşe.

The Nash social welfare stands between the two extremes. In a sum, one person's large gain easily offsets another's small loss; in a product, however, if any one value approaches zero, it drags the whole product to zero. For this reason the product rewards balanced allocations. The Nash social welfare has one more property: it is unaffected by a change of scale. If all of Ali's values are multiplied by 10, the product of every allocation is multiplied by 10; the ranking does not change and the best allocation stays the same. With a sum, in contrast, if Ali's values are scaled up enough, all the items Ali values go to him. Since comparing people's value scales is often meaningless, this property matters.

With the values in Table 11.12, three of the 16 possible allocations can be compared.

Table 11.14: Comparison of three allocations under the welfare criteria.
AllocationAliAyşesumminimumproductenvy-free?
Round-robin: Ali {g1, g3}, Ayşe {g2, g4}10717770no, EF1
Utilitarian: Ali {g3, g4}, Ayşe {g1, g2}41418456no, not even EF1
Nash / egalitarian (not unique): Ali {g2, g3, g4}, Ayşe {g1}9817872yes
Example 11.23
  1. The utilitarian allocation. To maximize the sum, each item goes to whoever values it more: g1 (8 > 7) and g2 (6 > 5) to Ayşe, g3 (3 > 1) to Ali. For g4 there is a tie (1 = 1); here it is given to Ali. Total 4 + 14 = 18.
  2. The unfairness of the utilitarian allocation. Ali values Ayşe's bundle {g1, g2} at 7 + 5 = 12 and receives 4 himself. Even if g1 is removed, 5 > 4; if g2 is removed, 7 > 4. Whichever item is removed, the envy persists: it is not even EF1.
  3. The Nash allocation. Ali {g2, g3, g4} = 5 + 3 + 1 = 9, Ayşe {g1} = 8; product 72. Ali values Ayşe's bundle at 7 (< 9); Ayşe values Ali's bundle at 6 + 1 + 1 = 8 (= 8). Nobody envies.
  4. Not unique. The allocation Ali {g2, g3}, Ayşe {g1, g4} also gives (8, 9) and its product is again 72. Both allocations make the smallest value 8; both are optimal for Nash and egalitarian welfare.

That in the example the allocation that maximizes the Nash social welfare is also fair is not a coincidence. Caragiannis et al. (2016) showed that such an allocation is always at least EF1.

Theorem 11.5 (Caragiannis et al., 2016)

When values are non-negative and additive, the allocation that maximizes the Nash social welfare is both Pareto optimal and EF1. If the product is 0 for every allocation, first the number of people who receive positive utility is maximized, and then the product of those people's utilities.

This result is also reflected in the title of the paper: "The unreasonable fairness of maximum Nash welfare". The theorem shows that efficiency and fairness need not exclude each other. Maximizing a single number (the product) yields an allocation that can neither be improved without hurting someone nor contains envy beyond one item.

11.4.11The price of fairness and Pareto efficiency

Two notions are needed to measure how much a fairness constraint takes away from efficiency.

Definition 11.16
  • An allocation is Pareto efficient (Pareto optimal) if there is no other allocation that improves at least one person without making anyone worse off.
  • The price of fairness is the ratio of the largest social welfare among all allocations to the largest social welfare among fair allocations. If the ratio is close to 1, fairness is cheap.

With the values of Table 11.12, all 16 allocations can be scanned (each of the four items goes to one of two people: 24 = 16). The results of the scan are as follows. 11 of the 16 allocations are Pareto optimal; round-robin's (10, 7) allocation is one of them. For example, there is no other allocation that gives Ali no less than 10 and Ayşe no less than 7 and raises one of them. The allocations that maximize the sum and those that are envy-free are in the table below.

Table 11.15: The allocations with the largest sum and the envy-free allocations.
AllocationAliAyşesumenvy-free?
Ali {g3, g4}, Ayşe {g1, g2}41418no
Ali {g3}, Ayşe {g1, g2, g4}31518no
Ali {g2, g3, g4}, Ayşe {g1}9817yes
Ali {g2, g3}, Ayşe {g1, g4}8917yes
Example 11.24
  1. The largest social welfare: 18. Two allocations give it; they are identical except for who gets g4 (on g4 the two people's values are equal).
  2. Envy-free allocations: of the 16 allocations only two are envy-free. Because of the tie on g4, both are optimal for Nash and egalitarian welfare; their sums are 17.
  3. The price of fairness: 18/17 ≈ 1.059.
  4. Interpretation: For envy-freeness, 1 − 17/18 = 1/18 ≈ 5.6% of the social welfare is sacrificed.

The price of fairness is a ratio like the Price of Anarchy. In the Price of Anarchy, the loss comes from the players behaving selfishly: it is the ratio of the best outcome to the worst equilibrium reached by selfish players. In the price of fairness, the loss comes not from selfishness but from the fairness constraint. In both ratios the denominator holds the welfare "attainable under the constraint" and the numerator the unconstrained best welfare.

In this example the price is small. But the price is not always small. In the divisible cake, with n people the price of proportionality grows roughly in proportion to √n (Caragiannis et al., 2012). As the number of people grows, the obligation to give everyone at least 1/n becomes increasingly expensive compared with leaving the cake to whoever values it most.

Common mistake
  • Evaluating values on a common scale: Proportionality and envy-freeness are checked with each person's own value function. Whether Ayşe envies Ali is computed with Ayşe's values, not Ali's.
  • "If it is proportional it is envy-free": This is true only for two people. In the three-person example (Table 11.10) the allocation is proportional but Ayşe envies Cem.
  • Removing any item in EF1: EF1 asks for a suitable item to be removed from the envied person's bundle; usually the item that is most valuable in the envier's eyes is removed. If one removes a random item and the envy persists, it does not follow that the allocation is not EF1.
  • Giving the piece to the first cutter in the last diminisher: The person who trimmed the piece last takes it. Only if nobody trimmed does the piece go to the first cutter.
  • Finding the cut by length: The cutter makes equal pieces "in their own eyes". Ayşe's halfway point is not at length 1/2 but at the point 2/3.

11.5Ethics and governance

Criteria and algorithms describe the measurable face of fairness. But mathematics does not decide by which criterion a model will be evaluated, who may object, or who is responsible if there is an error. These questions extend to ethical principles and the legal framework, to people's strategic response to the algorithm, to auditing, and to how decisions change their own data.

11.5.1Ethical principles and standards

Although the principles proposed for algorithmic decision systems appear under different names in different institutions, four principles are found in almost all of them.

Transparency and explainability
Transparency means that the decision process is understandable, that is, which data are used for which purpose. Explainability means that the reason for a single decision can be explained to the person concerned. A person whose credit is rejected should be able to learn the reason for the decision (for example "debt-to-income ratio too high").
Accountability
Accountability means that it is clear who is responsible for a wrong decision. "The algorithm decided so" does not count as a justification. A person affected by the decision should be able to object and to ask a human to review the decision.
Fairness and equality
The social effects of decisions and their outcomes by group must be taken into account. The criteria computed in this chapter are the measurable counterpart of this principle.
Privacy
Privacy means that personal data are collected to the minimum extent necessary and only for the stated purpose. The need for group information in order to measure fairness can create tension with privacy: an institution that does not collect the protected attribute also cannot measure whether its own model is fair with respect to that attribute.

These principles are also reflected in legal regulations.

Table 11.16: The main regulations and principles on algorithmic decisions.
RegulationContent
GDPR (EU, 2018), Article 22The right to object and to human intervention for decisions based solely on automated processing that significantly affect the person.
EU AI Act (2024)A risk-based approach: applications such as credit scoring and hiring are in the "high-risk" class and are subject to additional obligations (risk management, data quality, human oversight).
KVKK (Turkey), OECD AI PrinciplesRules for processing personal data (Law No. 6698); shared principles for trustworthy artificial intelligence.

What the regulations have in common is that the human is not removed entirely from high-impact decisions. The risk-based approach of the EU AI Act also carries a principle of proportionality: a movie recommendation system and a credit scoring system are not given the same obligations; the obligations grow with the magnitude of the possible harm.

11.5.2Strategic design and incentives

In the earlier sections people were treated as passive data points facing the model. But when an algorithm sets a rule, people respond to it. The people being classified are players too. This viewpoint is called strategic classification. The language of game theory can be used directly here: the institution chooses a rule (the leader) and the people give the best response to this rule (the followers).

A general consequence of this response is summarized by Goodhart's law: when a measure becomes a target, it ceases to be a good measure. Once click counts start to be used as a measure of success, content creators write clickbait headlines; clicks go up, but what the measure was meant to capture, the interest of the content, does not. The link between the measure and the quality one wants to measure is broken by targeting the measure.

Giving users the right incentives and preventing malicious manipulation (fake reviews, bot accounts) is part of the design. Three cases stand out:

A gameable feature
In a credit score, a feature that is easy to change, such as "the number of credit cards a person holds", changes the score without changing the real risk. The person's ability to pay stays the same while the score rises. This kind of behavior is called gaming.
Recommender systems
An objective that rewards engagement (watch time, clicks) can conflict with the user's long-term benefit. A better objective is one that rewards the user's long-term benefit; but measuring this benefit is much harder.
Unequal costs
If the cost of gaming differs among groups, strategic behavior creates a new unfairness. The group with plentiful resources adapts to the rule more easily. The example in 11.5.3 shows this step by step.

The basic question of mechanism design applies here too: honest behavior that follows the rule should be in the individual's interest. In a strategy-proof mechanism, behaving honestly is the best strategy; in a well-designed classifier too, the cheapest way to raise one's score should be to actually become more qualified.

11.5.3Strategic classification step by step

Hu, Immorlica, and Vaughan (2019) studied the effect of strategic behavior across groups with a simple model. The example below is a numerical version of this model.

The institution accepts those whose score is equal to or greater than the threshold. At first the threshold is 0.6. The true qualification is also measured by this score: people whose true score is 0.6 or above are truly qualified. People can raise their scores at a cost (for example by increasing the number of cards). Group A's budget is 0.15: everyone in A can raise their score by at most 0.15. Group B's budget is only 0.03. Each group has 5 unqualified and 5 qualified people.

Table 11.17: True scores in the strategic classification example.
groupbudgetunqualified (score < 0.6)qualified (score ≥ 0.6)
A0.150.30; 0.42; 0.50; 0.52; 0.580.62; 0.66; 0.71; 0.80; 0.90
B0.030.25; 0.35; 0.48; 0.56; 0.580.63; 0.68; 0.72; 0.78; 0.88

A person's decision is simple. If the true score is below the threshold and the distance to the threshold is less than or equal to the budget, the person moves the score to exactly the threshold and is accepted. If the distance is greater than the budget, raising the score is of no use; the person does not bear the cost.

Example 11.25
  1. Threshold 0.6, gaming. In A, the unqualified with a true score of at least 0.6 − 0.15 = 0.45 can reach the threshold: 0.50, 0.52, and 0.58. 3 unqualified people from A get through. In B at least 0.6 − 0.03 = 0.57 is needed: only 0.58. 1 unqualified person from B gets through.
  2. The institution responds. The institution notices the gaming and raises the threshold to 0.6 + 0.15 = 0.75, taking A's budget into account. The highest score the unqualified can reach is 0.58 + 0.15 = 0.73 in A and 0.58 + 0.03 = 0.61 in B. Both are below 0.75; now no unqualified person can get through.
  3. The qualified members of A. To get past the threshold, the true score must be at least 0.75 − 0.15 = 0.60. All five qualified members of A satisfy this (the lowest is 0.62). In A, 5 of 5 get through.
  4. The qualified members of B. The true score must be at least 0.75 − 0.03 = 0.72. 0.72, 0.78, and 0.88 get through; 0.63 and 0.68 do not. In B only 3 of 5 get through.

The measure taken against strategic behavior created a new inequality. The measure succeeded in keeping the unqualified out, but its price was paid by the qualified members of group B, whose budget is small. The institution's rule looks the same to the two groups (the same threshold), but the two groups' power to adapt to this rule differs.

....1score (true qualification)Abudget 0.15Bbudget 0.03threshold 0.6
Figure 11.16: Gaming at threshold 0.6. Filled circles are qualified people (score ≥ 0.6). Three unqualified people from A and one from B get through by moving their scores to the threshold (orange rings and arrows).
....1score (true qualification)Abudget 0.15Bbudget 0.03threshold 0.75
Figure 11.17: After the threshold is raised to 0.75. No unqualified person gets through. All five qualified members of A reach the threshold with their budget; the qualified members of B with scores 0.63 and 0.68 (red) cannot.

Figure 11.16 and Figure 11.17 compare the two stages. Raising the threshold is a crude way of imposing the cost of gaming on everyone. More refined solutions exist: giving weight to features that are hard to game, or making the resource needed for gaming (for example consulting or training) accessible to the low-budget group as well. A range computation can also be done in the example: for none of the unqualified to get through, the threshold must be greater than 0.73; for all of B's qualified to get through, the threshold must be at most 0.63 + 0.03 = 0.66. Since the two conditions contradict each other, the two goals cannot be achieved together with a single threshold.

11.5.4Algorithmic auditing

An algorithmic audit is the systematic examination of whether a decision system works in line with its purpose, correctly, and fairly. The audit covers not only the system's code but its whole life cycle.

What is audited?
The data source, the target variable, performance by group, and human oversight are examined together. Whether the target variable is a proxy (the health spending example in 11.1.3) is often the most important question.
Documentation
Model cards and dataset cards are short documents that make visible the assumptions, intended use, and known limitations of a model or dataset. A model card says, for example: "This model was trained on 2015–2020 credit applications; its accuracy is lower for applicants under 25."
After deployment
The model continues to be monitored after it goes into use. Data drift, that is, the data the model encounters moving away over time from the training data, as well as objections and unexpected harms, are tracked regularly.
Participation
The views of the affected groups are sought. A right to object and a clear chain of responsibility are defined.

The numerical part of the chapter gives the most concrete step of an audit: an audit checklist. In the list the base rates, the selection rate, TPR, FPR, PPV, and calibration are reported separately for each group. Because the impossibility theorems mean that not all of these criteria can be satisfied together, the reason for prioritizing a given criterion is justified in writing. Table 11.5 is the smallest form of such a report.

11.5.5Can algorithms be neutral?

It is often said that algorithms are "neutral because they are mathematics". The findings of the chapter limit this claim in four ways:

  • Algorithms are not independent of the values of the institutions that make the choices of target, data, criterion, and threshold. Even the answer to the question "what are we going to predict?" is a choice of values.
  • Historical inequalities can be reflected in the training data and the target variables.
  • Different fairness criteria produce conflicting results for the same decision (the impossibility theorems). Choosing one criterion means giving up another.
  • After deployment, the model can create new feedback loops by changing behavior (11.5.6).

The basic difficulties are also clear. The notion of fairness changes with the context: the type of error that matters in a credit decision can be different in a medical screening decision. There are trade-offs among accuracy, privacy, and group fairness. Conceptions of fairness vary from culture to culture. A reasonable answer to these difficulties is to give up the claim of absolute neutrality. Instead, the effects of the decision are measured, the choices made are documented, and an objection mechanism is set up for the people affected.

11.5.6Code trace: self-confirming data

The best-known example of a feedback loop is predictive policing. Patrols are sent to the region where incidents were frequent in past records. But an incident is recorded only where the patrol is present. In this case the records begin to reflect not the true distribution of incidents but where the patrol went (Ensign et al., 2018). The code below is the simplest model of this loop.

records = [6, 5]   # past records (region 0, 1)
actual = [3, 3]    # true daily incidents: equal!
for day in range(1, 5):
  target = 0 if records[0] >= records[1] else 1
  records[target] += actual[target]  # only there
  share = records[0] / sum(records)
  print(day, target, records, round(share, 2))

There are two regions in the code. The list records holds each region's past incident record: region 0 has 6 records and region 1 has 5. The list actual is the number of incidents that really occur in each region each day: 3 in both regions. That is, the two regions are in reality equal; a difference in the records is perhaps a coincidence. Each day the patrol goes to the region with more records (to region 0 in case of a tie). Only in the region the patrol goes to are that day's incidents entered in the records. share is region 0's share of the total records.

Table 11.18: Trace of the feedback code. Start: records = [6, 5], share = 6/11 ≈ 0.55.
daytargetrecordsshareunseen incidents (region 1)
10 (6 ≥ 5)[9, 5]9/14 ≈ 0.643
20 (9 ≥ 5)[12, 5]12/17 ≈ 0.713
30 (12 ≥ 5)[15, 5]15/20 = 0.753
40 (15 ≥ 5)[18, 5]18/23 ≈ 0.783
18region 0actual: 3/day5region 1actual: 3/day◀ patrol..5.01234dayregion 0's share of recordstrue share 0.5
Figure 11.18: After four days the records are [18, 5]. The chart on the right shows region 0's share of the records: it rises from 0.55 to 0.78. The true share (green dashed line) stays fixed at 0.5.

Every day the patrol goes to region 0, because region 0's record is always larger. Region 0's record grows by 3 each day; the 3 incidents in region 1 are never seen and its record freezes at 5. Figure 11.18 shows the result: the share rises from 0.55 to 0.78. Because the data are collected by the model's decision, they "confirm" the model. An observer looking at the records may conclude "there is more than three times as much crime in region 0 as in region 1"; yet in reality the two regions are equal. The initial difference of a single record (6 against 5), perhaps merely a coincidence, grew itself into a lasting "truth".

Example 11.26

If the same code is run with records = [5, 6], what is region 0's share after 4 days?

  1. Day 1: region 1's record is larger (6 > 5); the patrol goes to region 1: [5, 9].
  2. Day 2: [5, 12]. Day 3: [5, 15]. Day 4: [5, 18].
  3. The share is 5/23 ≈ 0.22.

The patrol always goes to region 1. The initial difference of a single record this time grows in the opposite direction. What determines the direction of the result is not the true crime rates but the accidental initial difference.

There are ways of breaking the loop. The patrol can be sent to random regions from time to time; in this way some unbiased data are collected from every region. Or the records can be corrected by dividing by how much patrol was sent to the region. These two ideas correspond to the "exploration and exploitation" trade-off in learning theory: a system that only exploits the best-known option collects no information at all about the other options.

11.5.7Real-world applications

The concepts of the chapter come up especially often in three areas:

Credit and banking
Scoring models. The real choice is between calibration and equal opportunity: the institution wants the score to convey the same risk in every group, while applicants want those who could repay to get the same chance.
Hiring and human resources
Résumé screening. Historical data bias (the Amazon example) and the four-fifths rule are the most frequent topics.
Healthcare
Diagnosis and treatment recommendations. The proxy target problem (spending ≠ need) can have grave consequences here.

The basic analysis applied in these areas is to study how changing a threshold affects the criteria. Since the chapter's example model gives only two scores, there are only three meaningful decision rules: reject everyone (threshold above 0.8), approve only those with 0.8 (threshold between 0.2 and 0.8), and approve everyone (threshold below 0.2).

Example 11.27
  1. Approve everyone. In both groups the selection rate is 1, TPR is 1, and FPR is 1. Demographic parity and equalized odds hold. But PPV is the repayment rate of those approved (that is, of everyone): 0.50 in A and 0.32 in B. Predictive parity is broken. Accuracy falls to 0.50 in A and 0.32 in B.
  2. Approve only those with 0.8 (today's model). Predictive parity and calibration hold; demographic parity and equalized odds do not (Table 11.5). Accuracy is 0.80 in both groups.
  3. Reject everyone. The selection rate, TPR, and FPR are 0 in both groups; demographic parity and equalized odds hold. PPV is undefined (nobody is approved). Accuracy is 0.50 in A and 0.68 in B. The institution gives no credit at all.

The two rules that satisfy equalized odds (approve everyone, reject everyone) render the model entirely useless. Rejecting everyone is the TPR = 0 extreme case of the impossibility theorem in 11.3.1; approving everyone satisfies equalized odds while breaking predictive parity. The three rules show one thing concretely: unless the model's power to discriminate changes, all the criteria cannot be satisfied together just by playing with the threshold.

Common mistake
  • Counting the same rule applied to everyone as fairness: In the strategic classification example the threshold is the same for the two groups, but the groups adapt to the rule at different costs. Formal equality does not bring equality of outcomes.
  • Taking records for reality: In a feedback loop the records measure where the patrol went. Data collected by a process that is influenced by a decision need care when they are used to evaluate that decision.
  • Treating an audit as a one-off: Because of data drift and strategic response, a model that is fair today may not be fair tomorrow. The audit continues after deployment.
  • Equating "human review" with accountability: A human who merely approves the decision and does not question its rationale does not provide accountability. The person who objects must be able to reach the rationale of the decision.

11.6Summary

  • Bias comes from historical data, underrepresentation, proxy variables, and design and feedback loops. Removing the protected attribute from the model is not enough; proxies carry it. This is why outcomes are measured by group.
  • The confusion matrix (TP, FP, FN, TN) is the source of all group criteria: selection rate (TP + FP)/n, TPR TP/(TP + FN), FPR FP/(FP + TN), PPV TP/(TP + FP), base rate (TP + FN)/n.
  • Criteria: demographic parity (selection rate; the four-fifths rule asks for a ratio ≥ 0.8), equalized odds (TPR and FPR; equal opportunity if only TPR), predictive parity (PPV), calibration (the realized rate of those with score s is s in every group). Equalized odds is the applicant's viewpoint and the last two are the institution's; demographic parity does not use the actual outcome at all.
  • Our example: a model that is calibrated and has equal PPV (0.8); nevertheless the selection rates are 0.5/0.2, TPR 0.8/0.5, FPR 0.2/0.059. Accuracy is 80% in both groups; accuracy does not show on whom the errors fall.
  • Individual fairness asks for similar scores for similar people: |f(x) − f(y)| ≤ L · d(x, y). Its difficulty is that the choice of the distance d is also a value judgment.
  • Incompatibility: FPR = p/(1 − p) · (1 − PPV)/PPV · TPR (Chouldechova). If base rates differ, predictive parity and equalized odds cannot hold together, except under perfect prediction. Kleinberg et al.: calibration and the two balances also hold together only under perfect prediction or equal base rates. In the COMPAS debate both sides were right by their own criterion.
  • Trade-off: forcing equalized odds lowers PPV in B from 0.8 to 0.65; equal opportunity by randomization (q = 0.6) lowers accuracy from 0.8 to 0.512. A fairness constraint is added by pre-processing, in-processing, or post-processing; which criterion to choose is a value decision.
  • Fair division: proportionality vi(Xi) ≥ 1/n, envy-freeness vi(Xi) ≥ vi(Xj). Cut and choose is proportional and envy-free for two people; cutting honestly is the maximin strategy, and the chooser is better off than the cutter. For two people proportionality ⇔ envy-freeness; for three or more, envy-freeness is stronger.
  • Algorithms: the last diminisher and the moving knife are proportional for n people (O(n²) queries), Even–Paz with fewer queries; Selfridge–Conway is envy-free for 3 people, Aziz–Mackenzie for n people. A cut query is found by bisection; after k queries the error is at most 2−(k+1).
  • Indivisible goods: envy-freeness is not always possible; round-robin produces EF1, but greedy picking may not be a best response. The allocation that maximizes the Nash social welfare is Pareto optimal and EF1. In the example the price of fairness is 18/17 ≈ 1.059.
  • Ethics: transparency, accountability, fairness, privacy; GDPR Article 22, the EU AI Act, KVKK. In an audit, the base rate, selection rate, TPR, FPR, PPV, and calibration are reported for each group, and the choice of criterion is justified.
  • Incentives: people who respond to the algorithm set Goodhart's law in motion. In strategic classification, if the cost of gaming differs among groups, a new inequality arises; in a feedback loop, the data confirm the decision itself.
Table 11.19: The concepts of the chapter at a glance.
ConceptWhat it saysHow it is computed
Demographic parityGroups are approved at equal ratesSelection rates are compared
Equalized oddsThose in the same actual situation have equal chancesTPR and FPR are compared
Predictive parityAn approval carries the same meaning in the two groupsPPV is compared
CalibrationThe score conveys the same risk in every groupRealized rate at each score level
Individual fairnessSimilar scores for similar peopleLipschitz condition
Chouldechova identityIf base rates differ, the criteria conflictFPR = p/(1 − p) · (1 − PPV)/PPV · TPR
ProportionalityEveryone receives ≥ 1/n in their own eyesCut and choose, last diminisher, moving knife
Envy-freenessNobody prefers another's shareCut and choose (2), Selfridge–Conway (3)
EF1Envy is at most one itemRound-robin and maximum Nash welfare (for non-negative additive values; in round-robin everyone takes the item most valuable in their own eyes)
Price of fairnessThe welfare loss of a fairness constraintLargest SW ÷ largest SW among fair allocations

11.7Key terms

  • algorithmic fairness
  • bias
  • protected attribute
  • proxy variable
  • confusion matrix
  • accuracy
  • selection rate
  • true positive rate (TPR)
  • false positive rate (FPR)
  • false negative rate (FNR)
  • positive predictive value (PPV), precision
  • negative predictive value (NPV)
  • base rate
  • group fairness
  • demographic parity
  • four-fifths rule
  • equalized odds
  • equal opportunity
  • predictive parity
  • calibration within groups
  • individual fairness
  • Lipschitz condition
  • impossibility theorems
  • Chouldechova's identity
  • balance for the positive/negative class
  • loss function
  • pre-processing / in-processing / post-processing
  • fair division
  • cake cutting
  • valuation function
  • Robertson–Webb query model
  • cut query
  • bisection
  • proportionality
  • envy-freeness
  • cut and choose
  • last diminisher
  • moving knife
  • indivisible goods
  • bundle
  • round-robin
  • envy-free up to one good (EF1)
  • utilitarian welfare
  • egalitarian welfare
  • Nash social welfare
  • Pareto efficiency
  • price of fairness
  • transparency
  • explainability
  • accountability
  • privacy
  • strategic classification
  • gaming
  • Goodhart's law
  • algorithmic audit
  • model card
  • data drift
  • feedback loop

11.8Test Yourself

  1. The confusion matrix of a group D is TP = 24, FP = 6, FN = 16, TN = 54. What are the selection rate, TPR, FPR, PPV, and accuracy? Compared with group A of the chapter (selection 0.5; TPR 0.8; FPR 0.2; PPV 0.8), which criterion holds? What does the four-fifths rule say?

    Answer

    n = 100. Selection (24 + 6)/100 = 0.30; TPR 24/40 = 0.6; FPR 6/60 = 0.1; PPV 24/30 = 0.8; accuracy (24 + 54)/100 = 0.78. Only predictive parity holds (0.8 = 0.8). The four-fifths rule: 0.30/0.50 = 0.6 < 0.8 ⇒ violated. Check with the identity: base rate p = 40/100 = 0.4; (0.4/0.6) · (0.2/0.8) · 0.6 = 0.1 ✓.

  2. In one group the base rate is p = 0.3, PPV = 0.6, TPR = 0.7. What is the FPR? In a second group with base rate 0.5, if PPV and TPR are kept the same, what is the FPR? Can equalized odds hold in these two groups?

    Answer

    First group: (0.3/0.7) · (0.4/0.6) · 0.7 = 0.3 · (2/3) = 0.2. Second group: (0.5/0.5) · (2/3) · 0.7 = 7/15 ≈ 0.467. The TPRs are equal but the FPRs differ (0.2 ≠ 0.467); equalized odds does not hold. When PPV is equal, the difference in base rates is carried into the FPR through the factor p/(1 − p).

  3. A model gives two scores: 0.7 and 0.1. In one group, of the 30 people with score 0.7, 21 repay the loan, and of the 70 people with score 0.1, 7 repay. Is the model calibrated in this group? What is the base rate? What are the average scores of those who repay and of those who do not?

    Answer

    21/30 = 0.7 and 7/70 = 0.1: at both score levels the realized rate equals the score, so the model is calibrated. The base rate is (21 + 7)/100 = 0.28; this equals the average score (30 · 0.7 + 70 · 0.1)/100 = 0.28. The average score of those who repay is (21 · 0.7 + 7 · 0.1)/28 = 15.4/28 = 0.55. Those who do not repay are 9 (with score 0.7) and 63 (with score 0.1); the average is (9 · 0.7 + 63 · 0.1)/72 = 12.6/72 = 0.175.

  4. The cake is [0, 1]; the left half is vanilla and the right half chocolate. Ali values every part equally. For Ayşe all the vanilla is worth 2/5 and all the chocolate 3/5 (uniform within each half). (a) If Ali cuts and Ayşe chooses, what does each get in their own eyes? (b) If Ayşe cuts, where does she cut, and who gets what?

    Answer

    (a) Ali cuts at x = 1/2. For Ayşe the left is 2/5 and the right is 3/5; she chooses the right. Ali gets 1/2 and Ayşe 3/5. (b) Since all the vanilla is worth 2/5 < 1/2 to Ayşe, the cut is in the chocolate. In the chocolate a unit of length is worth (3/5)/(1/2) = 6/5. 2/5 + (6/5)(x − 1/2) = 1/2 ⇒ x − 1/2 = 1/12 ⇒ x = 7/12. Ali chooses the left piece and gets 7/12 ≈ 0.583; Ayşe gets 1/2. The chooser is again better off.

  5. In the individual fairness condition, L = 3, d(x, y) = 0.1, and f(x) = 0.25. If scores lie in the interval [0, 1], in what range can f(y) be?

    Answer

    |f(y) − 0.25| ≤ 3 · 0.1 = 0.3 ⇒ −0.05 ≤ f(y) ≤ 0.55. Since a score cannot go below 0, the range is [0, 0.55].

  6. Two people share four indivisible items. Values: Ali (g1 8, g2 4, g3 2, g4 1), Ayşe (g1 5, g2 5, g3 4, g4 1). In round-robin with Ali starting, who takes what; is the allocation envy-free, is it EF1? Which allocation maximizes the Nash social welfare?

    Answer

    Ali g1 (8), Ayşe g2 (5), Ali g3 (2), Ayşe g4 (1). Ali {g1, g3} = 10, Ayşe {g2, g4} = 6. Ayşe values Ali's bundle at 5 + 4 = 9 > 6: she envies. When g1 is removed, 4 ≤ 6: EF1. The product is 60. Scanning the 16 allocations, the largest product is in the allocation Ali {g1, g4} = 9, Ayşe {g2, g3} = 9: 81. This allocation is envy-free (Ali values Ayşe's bundle at 6 and Ayşe values Ali's at 6) and its sum (18) is also the largest; in this example the price of fairness is 1.

  7. The feedback code is run with records = [7, 5] and actual = [2, 4]; that is, more incidents really occur in region 1. After 4 days, what are the records and region 0's share of the records? What is the true share?

    Answer

    Every day region 0's record is larger and the patrol goes there: [9, 5], [11, 5], [13, 5], [15, 5]. The shares are 0.64, 0.69, 0.72, 0.75. The true share is 2/(2 + 4) ≈ 0.33. The records reverse the truth: most incidents are in region 1, but by the records region 0 looks three times as "dangerous".

11.9Further reading

  • S. Barocas, M. Hardt, and A. Narayanan, Fairness and Machine Learning: Limitations and Opportunities (2023): a textbook that presents group criteria, impossibility results, and causal approaches in detail and with examples; its online version is free.
  • A. Chouldechova, "Fair prediction with disparate impact" (2017), and J. Kleinberg, S. Mullainathan, and M. Raghavan, "Inherent trade-offs in the fair determination of risk scores" (2017): the original papers of the two impossibility results in this chapter; the introductions of both can be read with little mathematics.
  • A. D. Procaccia, "Cake cutting algorithms", Handbook of Computational Social Choice, Chapter 13 (2016): summarizes the Robertson–Webb model, the last diminisher, Even–Paz, and the complexity of envy-free protocols.
  • S. J. Brams and A. D. Taylor, Fair Division: From Cake-Cutting to Dispute Resolution (1996): presents fair division methods with real dispute examples, in non-technical language.

11.10References

  1. J. Angwin, J. Larson, S. Mattu, L. Kirchner, “Machine Bias”, ProPublica, 2016.
  2. H. Aziz, S. Mackenzie, “A discrete and bounded envy-free cake cutting protocol for any number of agents”, IEEE FOCS, 2016.
  3. S. Barocas, M. Hardt, A. Narayanan, Fairness and Machine Learning: Limitations and Opportunities, MIT Press, 2023.
  4. S. J. Brams, A. D. Taylor, Fair Division: From Cake-Cutting to Dispute Resolution, Cambridge University Press, 1996.
  5. E. Budish, E. Cantillon, “The multi-unit assignment problem: theory and evidence from course allocation at Harvard”, American Economic Review 102(5), 2012.
  6. J. Buolamwini, T. Gebru, “Gender Shades: Intersectional accuracy disparities in commercial gender classification”, Proc. FAT*, 2018.
  7. I. Caragiannis, C. Kaklamanis, P. Kanellopoulos, M. Kyropoulou, “The efficiency of fair division”, Theory of Computing Systems 50(4), 2012.
  8. I. Caragiannis, D. Kurokawa, H. Moulin, A. D. Procaccia, N. Shah, J. Wang, “The unreasonable fairness of maximum Nash welfare”, ACM EC, 2016.
  9. A. Chouldechova, “Fair prediction with disparate impact: a study of bias in recidivism prediction instruments”, Big Data 5(2), 2017.
  10. J. Dastin, “Amazon scraps secret AI recruiting tool that showed bias against women”, Reuters, October 10, 2018.
  11. L. E. Dubins, E. H. Spanier, “How to cut a cake fairly”, American Mathematical Monthly 68(1), 1961.
  12. C. Dwork, M. Hardt, T. Pitassi, O. Reingold, R. Zemel, “Fairness through awareness”, ITCS, 2012.
  13. D. Ensign, S. A. Friedler, S. Neville, C. Scheidegger, S. Venkatasubramanian, “Runaway feedback loops in predictive policing”, Proc. FAT*, 2018.
  14. S. Even, A. Paz, “A note on cake cutting”, Discrete Applied Mathematics 7(3), 1984.
  15. M. Hardt, E. Price, N. Srebro, “Equality of opportunity in supervised learning”, NeurIPS, 2016.
  16. L. Hu, N. Immorlica, J. W. Vaughan, “The disparate effects of strategic manipulation”, Proc. FAT*, 2019.
  17. A. R. Karlin, Y. Peres, Game Theory, Alive, AMS, 2017 (chapter on fair division).
  18. J. Kleinberg, S. Mullainathan, M. Raghavan, “Inherent trade-offs in the fair determination of risk scores”, ITCS, 2017.
  19. A. D. Procaccia, “Cake cutting algorithms”, in F. Brandt et al. (eds.), Handbook of Computational Social Choice, Chapter 13, Cambridge University Press, 2016.
  20. European Parliament and Council, General Data Protection Regulation (GDPR), Regulation (EU) 2016/679, Art. 22 (applicable 2018).
  21. European Parliament and Council, Artificial Intelligence Act, Regulation (EU) 2024/1689.
  22. Law No. 6698 on the Protection of Personal Data (KVKK), Official Gazette of Turkey, April 7, 2016.
  23. OECD, Recommendation of the Council on Artificial Intelligence (OECD AI Principles), 2019.

Related pages: Chapter 11 slides · Course pages: Procaccia CMU 15-896 · Shah CSC304 · © Sercan Külcü. All rights reserved.