# Fairness: Demographic parity

One method we can use to evaluate our model's predictions for fairness is to
compare the admissions rate for the majority group and the minority group.
If the two admissions rates are equal, then the model's predictions exhibit
[**demographic parity**](https://developers.google.com/machine-learning/glossary#demographic-parity): a
student's chance of being admitted to the university doesn't vary by
demographic group.

Suppose the admissions model accepts 16 candidates from the majority
group and 4 candidates from the minority group. The model's decisions
satisfy demographic parity, as the acceptance rate for both majority and
minority candidates is 20%.
![Candidate pool, split into two groups: Rejected Candidates (64 blue
students, 16 orange students) and Accepted Candidates (16 blue
students, 4 orange students).](https://developers.google.com/static/machine-learning/crash-course/fairness/images/fairness_metrics_demographic_parity.png) **Figure 2.** Candidate pool split into two groups: Rejected Candidates and Accepted Candidates. Both the majority (blue) and minority (orange) groups have an acceptance rate of 20%.

The following table quantifies the numbers supporting the rejected and accepted
candidates in Figure 2.

|   | Majority group | Minority group |
|---|---|---|
| **Accepted** | 16 | 4 |
| **Rejected** | 64 | 16 |
| **Acceptance Rate** | 20% | 20% |

## Exercise: Check your intuition

The university admissions committee is considering using demographic parity
as the fairness evaluation metric for their model, and needs your guidance
on the benefits and drawbacks of this approach. Can you identify one
**pro** and one **con** of evaluating the model's predictions using demographic
parity?
Can you identify any problems with the feature data? Click here to see our answers Continue reading the next section, **Benefits and
Drawbacks**, for our summary of the key pros and cons of using
demographic parity.

## Benefits and Drawbacks

The key benefit of demographic parity for our admissions example is that it
ensures that both majority and minority groups are represented in the admitted
class of students in the same proportions as they are in the candidate pool.
That is, if the applicant pool is comprised of 80% majority-group candidates
and 20% minority-group candidates, demographic parity guarantees that the group
of admittees will also be 80% majority-group students and 20% minority-group
students.

However, demographic parity has one significant drawback: it does not take the
*distribution* of predictions for each demographic group (the number of
students classified as "qualified" vs. "unqualified") into account when
evaluating how the 20 admissions slots should be allocated.

Let's take another look at the composition of our candidate pool from above.
However, this time we'll classify candidates not only by demographic group,
but also by whether the model has scored each candidate as "qualified" or
"unqualified":
![The same breakdown of Rejected vs. Accepted candidates as in
the previous image, but this time the 50 students who are actually
qualified (35 blue students, 15 orange students) are shaded in green,
and the subset of qualified students who were rejected (19 blue students,
11 orange students) are marked with an X.](https://developers.google.com/static/machine-learning/crash-course/fairness/images/fairness_metrics_demographic_parity_by_qualifications.png) **Figure 3.** The same breakdown of Rejected and Accepted candidates as in Figure 2, but this time all qualified students in both the majority and minority groups are shaded in green, and the qualified students who were rejected are marked with an X. Of the 35 qualified majority-group students, 16 were accepted. Of the 15 qualified minority-group students, 4 were accepted.

The following table quantifies the numbers supporting the rejected and accepted
candidates in Figure 3.

|   | Majority group || Minority group ||
|   | Accepted | Rejected | Accepted | Rejected |
|---|---|---|---|---|
| **Qualified** | 16 | 19 | 4 | 11 |
| **Unqualified** | 0 | 45 | 0 | 5 |

Let's tabulate the acceptance rates for qualified students for both groups:
$$\\text{Majority acceptance rate} = \\frac{\\text{qualified majority students accepted}}{\\text{total qualified majority students}} = \\frac{16}{35} = \\text{46%}$$ $$\\text{Minority acceptance rate} = \\frac{\\text{qualified minority students accepted}}{\\text{total qualified minority students}} = \\frac{4}{15} = \\text{27%}$$

Even though both groups have an overall acceptance rate of 20%, satisfying
demographic parity, the acceptance rate for qualified majority students is 46%,
whereas the acceptance rate for qualified minority students is only 27%.

In cases like this, where the distribution of a preferred label
(such as "qualified") varies greatly for both groups, demographic parity may
not be the optimal metric to choose for evaluating fairness. In the next
section, we'll look at an alternative fairness metric, equality of opportunity,
which takes these differences into consideration.

> [!NOTE]
> **Note:** There may be additional benefits/drawbacks of demographic parity not discussed here that are also worth considering, depending on both the goals the model is designed to achieve and the social context in which the model's predictions will be used.

> [!IMPORTANT]
> **Key terms:**
>
> - [Bias (ethics/fairness)](https://developers.google.com/machine-learning/glossary#bias-ethicsfairness)
> - [Demographic parity](https://developers.google.com/machine-learning/glossary#demographic-parity)

[Help Center](https://support.google.com/machinelearningeducation)