Ethics & AI
Detecting Bias in ML Pipelines with Fairlearn and SHAP
A practical walkthrough of measuring demographic parity and using SHAP to explain model decisions to non-technical stakeholders.
By Ijlal Ansari
Fairness in machine learning isn't a single metric — it's a family of sometimes-contradictory definitions. Demographic parity, equalized odds, and calibration each capture different aspects of what 'fair' means.
Fairlearn makes it straightforward to measure these metrics across protected groups. The key insight is that you need to define your fairness criteria before training, not after.
SHAP (SHapley Additive exPlanations) bridges the gap between technical model behavior and stakeholder understanding. When a loan application is denied, SHAP can show exactly which features contributed most to that decision.
The combination of Fairlearn for measurement and SHAP for explanation creates a powerful audit toolkit that satisfies both technical teams and compliance officers.