6.1 Prediction and decisions
Selective labels: evaluating a prediction model on data from past decisions
Past decisions choose which outcomes a prediction model can learn from. This page shows how a simple evaluation can then make the model look better than it is. It also shows contraction, a method that uses only observed outcomes.
In brief
Before a trial, a judge decides whether to release a defendant or to detain the defendant in jail. A released defendant can fail to appear in court, and we call this failure to appear (FTA). A model predicts the risk of FTA from the recorded features of a case, but the data show FTA only for released defendants. In court, judges can also notice things that the data do not record, which we call judge-only information.
- The release rate is the share of defendants released.
- The failure rate is the number of defendants who fail to appear, divided by all defendants, released or detained.
- A model rule releases a chosen share of the defendants: those with the lowest predicted risk. Its naive evaluation fills in each missing outcome with the predicted risk.
- The contraction estimate is the failure rate of the contraction rule. This rule lets the model detain more of the defendants whom the most lenient judge released. So the estimate uses only observed outcomes.
- Only the simulation knows the true failure rate of the model rule.
Move the sliders and watch these numbers. The explanation below the simulation gives the reasons.
Try it
The simulation has 12,000 defendants and 5 judges. Each judge hears 2,400 cases, and the simulation assigns the cases to judges at random. The sliders set how strongly the judge-only information predicts FTA, how much judges use it, the noise in their decisions, and two release rates.
How the simulation makes the data
Each defendant has one recorded feature, x, and one piece of judge-only information, z. The risk of FTA if released rises with x. It also rises with z when the first slider is above 0. The simulation draws the outcome if released for every defendant. Real data show this outcome only for released defendants.
Each judge ranks the cases by risk as the judge sees it: x, plus z times the second slider, plus random noise. The third slider sets the size of the noise. The judge releases a fixed share of the cases, those with the lowest values. Judge 1 is the strictest and releases 55%. Judge 5 is the most lenient, and the fourth slider sets this rate. The other judges are evenly spaced between them.
The model is a logistic regression of FTA on x, fit on released defendants only. A logistic regression predicts the probability of a yes-or-no outcome. The model rule releases the chosen share of all 12,000 defendants with the lowest predicted risk.
| Judge | Release rate | Failure rate of the judge | Contraction estimate | Model rule, naive evaluation | Model rule, true failure rate (simulation only) |
|---|
The model rule at a release rate of
- Naive evaluation
- True failure rate (simulation only)
- Naive minus true, in percentage points
Contraction on the cases of the most lenient judge
- Contraction estimate
- True failure rate of the contraction rule
- Extra detentions by the model, of 2,400 cases
Defendants whom the judges detained
- Number detained, of 12,000
- Average risk of FTA predicted by the model
- Average true risk of FTA (simulation only)
Three kinds of defendants: the strictest and the most lenient judge (simulation only)
The strictest judge releases of defendants. The most lenient judge releases . Both judges rank defendants by the risk that they see, so the simulation knows what each judge would decide for every defendant.
| Group | Share of defendants | True average risk of FTA if released |
|---|---|---|
| Released by both judges | ||
| Released only by the most lenient judge | ||
| Detained by both judges |
The idea
Before a trial, a judge decides whether to release a defendant or to detain the defendant in jail until the trial. A released defendant can fail to appear in court. We call this failure to appear (FTA). Kleinberg et al. (2018) study these decisions with pretrial release data from New York City. Their main outcome is FTA. For convenience, the paper calls this outcome crime.
A prediction model uses the recorded features of a case, for example the current charge and the prior record, to predict the risk of FTA. To train and test the model, we need cases with a known outcome. We call the known outcome a label.
A detained defendant cannot fail to appear, so nobody sees what that defendant would have done after release. The data have labels only for the defendants whom the judges released. Lakkaraju et al. (2017) call this the selective labels problem. It is a form of selection bias: the decisions under study choose which outcomes we observe (Barocas et al. 2023).
A judge or a model decides whom to release. We describe each set of decisions with two numbers. The release rate is the share of defendants released. The failure rate is the number of defendants who fail to appear, divided by all defendants, released or detained (Lakkaraju et al. 2017). A detained defendant counts as no FTA. With this denominator, we can compare decisions with different release rates.
In symbols, write \(x\) for the recorded features and \(z\) for the judge-only information. Write \(D = 1\) if the judge released the defendant and \(D = 0\) if the judge detained the defendant. Write \(Y(1)\) for FTA if released (1 for FTA, 0 otherwise). A rule releases a set \(S\) of the \(N\) defendants. Its failure rate is:
\[\text{failure rate} = \frac{1}{N} \sum_{i \in S} Y_i(1)\]
A model rule releases a chosen share of the defendants: those with the lowest predicted risk. To compute its failure rate, we need the outcome of every defendant that it releases. The judges detained some of these defendants, so their outcomes are missing. A simple approach fills in each missing outcome with the predicted risk from the model. The model learned this prediction from released defendants with the same recorded features. We call this approach the naive evaluation.
In symbols, let \(m(x)\) be the predicted risk from a model fit on released defendants. The naive evaluation uses \(m(x)\) in place of \(Y(1)\) for the defendants whom the judges detained:
\[\begin{aligned} \text{naive evaluation} = \frac{1}{N} \Bigl[ & \sum_{i \in S,\, D_i = 1} Y_i(1) \\ & + \sum_{i \in S,\, D_i = 0} m(x_i) \Bigr] \end{aligned}\]
Judges see the defendant in court. They can notice things that the data do not record. The example in Kleinberg et al. (2018) is a gang tattoo. We call such information judge-only information.
Suppose that judge-only information predicts FTA, and that judges detain defendants partly because this information signals a high risk. Then the detained defendants have a higher risk than released defendants with the same recorded features. The filled-in outcomes are too low, and the naive evaluation makes the model look better than it is. More adjustment for the recorded features does not remove this error. The error comes from information that the data do not record.
The imputation error in symbols
Kleinberg et al. (2018) use a model in which the risk is \(x + z\). In this model, \(x\) is the part of the risk that the recorded features predict. The rest of the risk, \(z\), is the part that only the judge sees. Suppose that we fill in the risk of a detained defendant with the average risk of released defendants who have the same \(x\). The filled-in value minus the true average risk is the imputation error:
\[\begin{aligned} \text{imputation error} = {} & E[z \mid \text{released}, x] \\ & - E[z \mid \text{detained}, x] \end{aligned}\]
Suppose that judges select on \(z\). That is, among defendants with the same \(x\), judges are more likely to detain those with a higher \(z\). Then the detained defendants have a higher average \(z\) than the released defendants with the same \(x\). So this error is below zero, and the filled-in risk is too low.
In the simulation, the risk rises with the judge-only information only when the first slider is above 0. At 0, the part of the risk that only the judge sees is zero for every defendant. Judges can still use the judge-only information, but the imputation error is then zero.
So the naive evaluation rests on an assumption: among defendants with the same recorded features, released and detained defendants have the same average risk. This is the assumption of no unmeasured confounding, also called selection on observables. Judge-only information that predicts FTA and drives decisions breaks it (Kleinberg et al. 2018).
The problem is one-sided (Kleinberg et al. 2018). Suppose that a rule detains a defendant whom the judge released. We observed the outcome of that defendant, so we can compute the new failure rate. Suppose instead that a rule releases a defendant whom the judge detained. Then nobody observed the outcome.
Contraction uses the side that we can measure (Lakkaraju et al. 2017). The leniency of a judge is the release rate of that judge. Take the most lenient judge. Start from the defendants whom this judge released. The model detains more of them, highest predicted risk first, until the release rate falls to a target rate. Everyone whom the judge detained stays detained.
Contraction in symbols
Contraction (Lakkaraju et al. 2017): let \(q\) be the most lenient judge, and \(C_q\) the cases of judge \(q\). Let \(R_q\) be the cases that judge \(q\) released. Take a target rate \(r\) at or below \(|R_q| / |C_q|\). Detain the cases in \(R_q\) with the highest \(m(x)\). The number of these extra detentions is:
\[\begin{aligned} \text{extra detentions} = {} & (1 - r)|C_q| \\ & - (|C_q| - |R_q|) \end{aligned}\]
The estimate is the number of defendants in the rest of \(R_q\) who fail to appear, divided by \(|C_q|\). Lakkaraju et al. (2017) write \(D_q\) for the cases of judge \(q\). This page uses \(C_q\), because \(D\) is the treatment indicator on this site.
We call the result the contraction rule. The judge released every defendant whom the contraction rule releases, so we observe all of their outcomes. No outcome needs to be filled in. Then we compare the failure rate of the contraction rule with the failure rate of a stricter judge who has the same release rate. Kleinberg et al. (2018) apply the same idea to groups of judges sorted by leniency.
Contraction needs three things: many judges, cases assigned to judges as good as at random, and judges who differ in leniency. As good as random means that each judge hears a comparable set of cases. In real courts, assignment is as good as random only within cells. A cell is a group of cases, for example the cases heard in the same borough, year, month, and day of the week. Kleinberg et al. (2018) check this with balance tests: they test whether the predicted risk of defendants differs between more and less lenient judges. Contraction does not assume that judges ignore judge-only information.
Contraction also has limits. It can evaluate only release rates at or below the release rate of the most lenient judge. It never releases a defendant whom that judge detained. So it evaluates the contraction rule, not a model rule that ranks all defendants.
Accuracy on the labeled cases does not answer the question either. A common accuracy measure is the area under the receiver operating characteristic curve (AUC). Take a randomly chosen case with the outcome and a randomly chosen case without the outcome. The AUC is the probability that the first case has the higher predicted risk. A high AUC on the labeled cases does not show that the model makes better release decisions than the judges (Kleinberg et al. 2018).
Three kinds of defendants: principal strata
Module 3.2 explains principal strata with a job training example. The same idea applies to judges. Take a lenient judge and a strict judge. Each defendant has two potential decisions, one from each judge. So defendants fall into groups by the pair of decisions: released by both judges, released only by the lenient judge, and detained by both judges.
A fourth group, released only by the strict judge, cannot exist when both judges rank defendants in the same order. In this simulation they do. Frangakis and Rubin (2002) call groups like these principal strata: groups defined by what would happen to each unit under each condition.
Nobody can see which group a defendant belongs to, because each defendant appears before one judge only. The strict judge releases fewer defendants. The extra defendants that the strict judge detains come from the middle group. Contraction lets the model choose whom to detain from the defendants that the lenient judge released. Then it compares the failure rates of the two choices at the same release rate.
For a detained defendant, FTA if released is a well-defined outcome that the data do not show. So it is missing. A wage for a person without a job is different: it does not exist.
References
- Barocas, S., Hardt, M., & Narayanan, A. (2023). Fairness and machine learning: Limitations and opportunities. MIT Press. https://fairmlbook.org/
- Frangakis, C. E., & Rubin, D. B. (2002). Principal stratification in causal inference. Biometrics, 58(1), 21-29. https://doi.org/10.1111/j.0006-341X.2002.00021.x
- Kleinberg, J., Lakkaraju, H., Leskovec, J., Ludwig, J., & Mullainathan, S. (2018). Human decisions and machine predictions. The Quarterly Journal of Economics, 133(1), 237-293. https://doi.org/10.1093/qje/qjx032
- Lakkaraju, H., Kleinberg, J., Leskovec, J., Ludwig, J., & Mullainathan, S. (2017). The selective labels problem: Evaluating algorithmic predictions in the presence of unobservables. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (pp. 275-284). Association for Computing Machinery. https://doi.org/10.1145/3097983.3098066