Course contentsShow
← Machine Learning and Deep Learning
Lesson 3311 of 3,53872. Bias and FairnessFree lesson

Regularization for Fairness

Add penalty terms to the objective that discourage disparate impact or demographic parity violations.

Regularization for Fairness

What you'll learn: How to incorporate fairness directly into your model's loss function by penalizing unfair outcomes during training.

The Core Idea

Instead of training your model to minimize prediction error alone, you add a penalty term to the objective function that punishes violations of fairness criteria like demographic parity or equalized odds. This approach builds fairness considerations directly into the optimization process rather than treating them as post-hoc corrections.

Think of it like driving: you're not just trying to reach your destination quickly (minimize loss), but also stay within speed limits and traffic rules (satisfy fairness constraints). The penalty terms act like traffic fines—they discourage you from taking unfair shortcuts.

How It Works

The modified loss function looks like:

Total Loss = Prediction Loss + λ × Fairness Penalty

Where:

  • Prediction Loss is your usual objective (cross-entropy, MSE, etc.)
  • Fairness Penalty measures violations of your chosen fairness criterion
  • λ (lambda) controls the trade-off between accuracy and fairness

For example, to encourage demographic parity, your penalty might measure the difference in positive prediction rates across protected groups. A larger penalty pushes the optimizer to reduce disparate impact.

The Trade-off

By adding this regularization term, you're explicitly telling the model: "I'm willing to sacrifice some accuracy to achieve fairer predictions across groups." The hyperparameter λ lets you control how much you care about fairness versus raw performance—higher λ means stronger fairness enforcement but potentially lower accuracy.

Key Takeaway: Regularization for fairness integrates bias mitigation directly into the training objective by adding penalty terms that discourage demographic parity or equalized odds violations, creating a tunable trade-off between model accuracy and group fairness.