Counterfactual Fairness Assessment
Counterfactual fairness asks whether a model's prediction for a person would stay the same if that person's protected attribute had been different while everything not caused by it stayed the same, under an explicit causal model of how the attribute affects the features.
반사실적 공정성은 보호 속성이 영향을 주는 경로에 대한 인과모형을 세운 뒤, 한 사람의 보호 속성만 달랐다면 모형의 예측이 그대로였을지를 따집니다.
Would my model give the same score to this applicant if only their sex or ethnicity had been different?
다른 조건은 그대로 두고 지원자의 성별이나 인종만 달랐다면 내 모형이 같은 점수를 주었을까요?
Each feature is modelled as a linear effect of the protected attribute plus person-specific noise. The noise is recovered from the data, the attribute is switched, and the counterfactual features are rebuilt. The change in the predictions of the attribute-unaware and attribute-aware models measures counterfactual unfairness, and a predictor built only on the noise terms shows the accuracy cost of a counterfactually fair model.
When to use Counterfactual Fairness Assessment
- You audit a scoring or classification model for individual-level fairness, not only group rates.
- You can state which features are and are not influenced by the protected attribute.
- You want to compare the accuracy of an unaware model with a counterfactually fair alternative.
When to use something else
- You need group-level metrics such as demographic parity or equalised odds: use Algorithmic Fairness Audit (Group Fairness Metrics)
- You cannot defend any causal model linking the protected attribute to the features: use Algorithmic Fairness Audit (Group Fairness Metrics)
- The protected attribute is itself caused by other measured features
Assumptions and requirements
- Protected attribute is a root cause (not caused by the features)
- Additive, linear effects of the attribute on descendant features
- Correctly declared non-descendant features
What the analysis reports
- Mean, mean absolute and maximum change of predictions for each switch of the protected attribute
- Decision flip rate at the chosen threshold for classifiers
- Effect of the protected attribute on each feature with F tests
- Cross-validated performance of unaware, aware and counterfactually fair predictors
How to report it
Switching the protected attribute changed the unaware model's predictions by [value] on average; the counterfactually fair predictor had a cross-validated AUC of [value] versus [value].
Related methods
- Algorithmic Fairness Audit (Group Fairness Metrics)
- Structural Causal Model (DAG)
- Causal Mediation Analysis (Natural Direct and Indirect Effects)
How this method is validated
이 방법의 검증 근거
- Independent computation. 1 reference test compares the results with statsmodels at a stated tolerance of 1e-6.
독립 계산. statsmodels 대조 참조 시험 1건 통과(허용오차 1e-6).
Tolerances are relative differences (absolute differences for values near zero). R comparisons and reference tests are re-run before each release of the analysis engine.
허용오차는 상대 차이입니다(0 근처 값은 절대 차이). R 대조와 참조 시험은 분석 엔진을 배포할 때마다 다시 돌립니다.
Run Counterfactual Fairness Assessment on Quorant
- Data you need
- a table (CSV or Excel) with an outcome variable, a grouping variable and predictor (feature) columns
- Price
- 400 credits for one analysis up to 10,000 rows (complexity level 3); larger or wider data costs more. Optional methodologist review: 1800 credits.
- Checking
- Compared with independent computations
- Before you pay
- A free pre-analysis diagnosis checks your data and gives an exact quote; nothing is deducted until you approve it.