Ethics: Measuring Fairness in Models

Dr. Ada Lovelace
AI Ethics Lead // QuantumML
Algorithms are opinions embedded in code. Without mathematical frameworks to measure and mitigate bias, Machine Learning models will simply scale historical inequalities.
Demographic Parity (Statistical Parity)
Demographic parity states that the proportion of each segment of a protected class (e.g., gender, race) should receive the positive outcome at equal rates. If 20% of Group A receives a loan, 20% of Group B should also receive a loan.
Formula: $DPD = |P(\hat{Y}=1 | A=0) - P(\hat{Y}=1 | A=1)|$
Disparate Impact (The 80% Rule)
Used heavily in US employment law, Disparate Impact compares the selection rates as a ratio rather than a difference. The "Four-Fifths Rule" states that the selection rate of a protected group should not be less than 80% of the selection rate of the highest-selected group.
Formula: $DI = \frac{P(\hat{Y}=1 | A=0)}{P(\hat{Y=1 | A=1)}$
Equal Opportunity
Sometimes, enforcing Demographic Parity harms model accuracy because base rates differ. Equal Opportunity requires that the True Positive Rates (TPR) are equal across groups. In other words, if a person is *actually qualified*, their chance of receiving the positive prediction should be independent of their group membership.
View Mitigation Strategies+
- Pre-processing: Reweighing the dataset or generating synthetic data to balance representation before training.
- In-processing: Adding fairness constraints directly into the loss function of the algorithm (e.g., Fairlearn's ExponentiatedGradient).
- Post-processing: Adjusting the decision thresholds differently for different groups to achieve parity.
❓ Frequently Asked Questions (AI Fairness)
Why can't we just remove the protected attribute (e.g., race or gender) from the dataset?
This approach is known as "fairness through unawareness." It rarely works because machine learning models easily find proxy variables (e.g., zip codes, purchasing habits, vocabulary) that highly correlate with the protected attribute, reconstructing the bias anyway.
Is there a tradeoff between fairness and accuracy?
Often, yes. This is called the Fairness-Accuracy tradeoff. When you constrain an optimizer to satisfy parity constraints, it might drop overall accuracy. However, a model with high accuracy but severe bias is legally and ethically flawed, making fairness a necessary constraint.