Sub topic 1
Why Fairness Assessment Matters: Harms and Context
A model can score well on a test set and still treat groups of people very differently. Fairness assessment is the practice of measuring those differences, judging whether they cause harm, and recording what you found. This chapter explains why the practice exists and how to decide what to measure. The later chapters cover the metrics and the audit workflow in detail.
Prerequisites
This chapter assumes you already know:
- Binary classification and the confusion matrix (TP, FP, TN, FN).
- Precision, recall, and false positive rate.
- How to split data into train and test sets and evaluate a model.
- Basic Python with NumPy, pandas, and scikit-learn.
You do not need any background in ethics, law, or statistics beyond this.
What "fairness assessment" means here
In this tutorial, a group is a set of people who share a value of some attribute, such as age band, sex, or region. A group fairness assessment compares how a model's decisions and errors are distributed across such groups. It answers questions like these:
- Does one group receive the favorable outcome more often than another?
- Does the model miss qualified people more often in one group?
- Do its scores mean the same thing for every group?
Fairness assessment does not prove a model is "fair" in a general sense. People disagree about what fair means, and the answer depends on the setting. What you can do is measure specific disparities, explain them, and make a defensible decision about what to do next.
Kinds of harm
Fairness work starts from harm. A disparity matters because someone is worse off because of it. Researchers commonly separate several kinds of harm, and each one points to different measurements.
| Harm | What happens | Example | Typical measurement |
|---|---|---|---|
| Allocation | An opportunity or resource is given or withheld unevenly | A loan model approves one group less often | Selection rate, true positive rate |
| Quality of service | The system works worse for some people | A speech recognizer has a higher error rate for some accents | Per-group accuracy, error rates |
| Representational | The system reinforces stereotypes or erases people | An image search returns biased results for a job title | Output audits, human review |
| Burden of error | A wrong decision costs one group more | A fraud flag freezes accounts of some customers more often | False positive rate by group |
Only the first, second, and fourth are easy to turn into numbers from a labeled table of predictions. Representational harm usually needs qualitative review. A clean set of metrics does not rule it out.
Context decides what to measure
The same model score can be harmless in one deployment and damaging in another. Before choosing any metric, answer these questions:
- What decision does the model feed? A ranking that orders a reading list is low stakes. A score that decides who gets a loan, a job interview, or bail is high stakes.
- Is the outcome favorable or unfavorable? For a benefit, such as a loan approval, the worry is people who are wrongly denied. For a penalty, such as a fraud flag, the worry is people who are wrongly flagged.
- Who is affected, and can they object? People who can appeal or opt out are in a different position from people who never learn a model was involved.
- Is there a human in the loop? A reviewer can catch some errors, but people tend to defer to the model's score, so a human step does not remove the need to measure.
- Does the model change the world it measures? A model that decides where police patrol will change the crime records it later trains on. This is a feedback loop.
These answers tell you which error matters most. In a lending model, a false negative (a creditworthy person denied) is the main harm to the applicant. In a fraud model, a false positive (a legitimate customer blocked) is the main harm. That is why a later chapter splits the criteria into those based on selection rates, error rates, and score meaning.
Why one overall metric is not enough
Overall accuracy averages over everyone. If one group is small, the model can do badly on it and the average barely moves. The example below builds that situation with synthetic data: group A has 900 people and group B has 100.
import numpy as np
rng = np.random.default_rng(0)
n_a, n_b = 900, 100
group = np.array(["A"] * n_a + ["B"] * n_b)
y_true = rng.integers(0, 2, size=n_a + n_b)
# The model is right 95% of the time for group A and 70% for group B.
p_correct = np.where(group == "A", 0.95, 0.70)
correct = rng.random(n_a + n_b) < p_correct
y_pred = np.where(correct, y_true, 1 - y_true)
print("overall accuracy:", round(float((y_true == y_pred).mean()), 3))
for g in ["A", "B"]:
m = group == g
print(g, "n =", int(m.sum()), "accuracy:", round(float((y_true[m] == y_pred[m]).mean()), 3))The overall accuracy comes out near 0.92, which looks fine in a report. Group A is near 0.95 and group B is near 0.70. The exact digits depend on the random seed, but the pattern does not. Group B makes up only 10% of the data, so its poor performance changes the overall number by only about 2.5 points.
This is the central reason to assess fairness separately: an aggregate metric answers "how good is the model on average," not "for whom is it good." The next chapters build the tools to compute the per-group numbers properly.
A note on what the data cannot tell you
Per-group numbers come from labeled data, and the labels are not always the truth. Suppose a model predicts "will reoffend," but the label is "was rearrested." If some neighborhoods are policed more heavily, arrest rates differ even when behavior does not. The model can then show equal accuracy across groups while both the labels and the predictions carry the same distortion. A measurement is only as meaningful as the label behind it. The next chapter covers where such distortions enter the pipeline.
Common errors
- Starting with a metric instead of a harm. Teams often pick demographic parity or equalized odds because a library offers it. Start with the decision and its harms, then choose the metric.
- Treating a passing check as a certificate. A gap of zero on one criterion says nothing about the others, and the criteria usually conflict (see the chapter on incompatibility).
- Ignoring the base population. Fairness depends on who is actually scored. A model evaluated on a convenience sample can look fair and still fail on the people it will meet in production.
- Dropping the sensitive attribute and calling it done. Removing a column such as sex does not remove its influence. Other features, such as postal code, can act as proxies. You also lose the ability to measure disparities, because you can no longer split results by that attribute.
- Looking at one moment only. Populations, policies, and models change, so a fairness check is a repeated task and not a one-time gate.
How this chapter connects to the rest
The plan for the remaining chapters follows the dependencies in this order. Harms and context come first, then the sources of bias and how to define groups. Per-group rates come next, and the individual criteria are built on them: demographic parity, equal opportunity and equalized odds, and predictive parity. After that come the reasons the criteria conflict, the statistics needed for small and intersectional groups, an audit workflow, tooling, mitigation, and documentation. At each step, the question from this chapter stays the same: who could be harmed, how, and which measurement would show it.
Exercise
A hospital uses a model to flag patients for an extra-care program that gives free home visits. Programs like this have limited capacity. Name the main harm type, say which error (false positive or false negative) matters most for patients, and give one per-group rate you would compute first. Then explain why overall accuracy would not be enough.
Show answer
The main harm is allocation: a benefit (the extra-care program) is withheld from people who need it. The error that matters most for patients is the false negative, a patient who needs the program but is not flagged. The first per-group rate to compute is the true positive rate (recall) for each group, since it shows how often needy patients in each group are actually flagged. Selection rate per group is a useful second check on who receives the program. Overall accuracy is not enough because it averages over everyone, so a large group with high accuracy can hide a small group where many needy patients are missed, as in the 95% versus 70% example above.