Counterfactual Explanations for a Logistic Regression Classifier
A counterfactual explanation tells a person the smallest change to their feature values that would make the classifier give the desired decision. Here the classifier is a logistic regression, distance is measured in units of each feature's median absolute deviation, and the closest counterfactual is found exactly under feature bounds and fixed (immutable) features.
분류기가 원하는 결정을 내리게 하려면 특성 값을 가장 적게 얼마나 바꾸어야 하는지를 알려 주는 설명입니다. 여기서는 로지스틱 회귀 분류기를 쓰고, 거리를 각 특성의 중앙값 절대편차 단위로 재며, 특성의 범위와 바꿀 수 없는 특성을 지키면서 가장 가까운 반사실 사례를 정확히 찾습니다.
For cases the model turned down, what is the smallest change in their features that would have changed the model's decision?
모형이 거절한 사례가 결정을 바꾸려면 특성을 최소한 어떻게 바꾸어야 했습니까?
For each explained row the method lists which features change and by how much, the new predicted probability and the distance. Because the distance is an L1 sum, solutions usually change only one or two features; infeasible rows have no counterfactual inside the allowed ranges.
When to use Counterfactual Explanations for a Logistic Regression Classifier
- You need actionable 'what would have to change' explanations for individual decisions.
- Some features (such as age) must stay fixed while others may change.
When to use something else
- You want how much each feature pushed one prediction: use SHAP (SHapley Additive exPlanations)
- You want a local surrogate explanation of a complex model: use LIME
Assumptions and requirements
- A logistic regression describes the decision rule well enough
- Features are numeric; binary features are treated as continuous unless held fixed
- Counterfactuals describe the model, not causal effects in the world
What the analysis reports
- Counterfactual feature values for each explained row
- Probability before and after
- MAD-weighted L1 distance and number of changed features
- How often each feature changes
How to report it
Counterfactual explanations for a logistic regression classifier (cross-validated accuracy [value]) were found for [value] of [value] rows; on average [value] features changed, with a MAD-weighted distance of [value].
Related methods
- SHAP (SHapley Additive exPlanations)
- LIME
- Regularized Logistic Regression (Lasso, Ridge, Elastic Net)
- Counterfactual Fairness Assessment
How this method is validated
이 방법의 검증 근거
- Independent computation. 1 reference test compares the results with direct computations (formulas, enumeration or simulation).
독립 계산. 직접 계산(식·열거·모의실험) 대조 참조 시험 1건 통과.
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 Explanations for a Logistic Regression Classifier on Quorant
- Data you need
- a table (CSV or Excel) with an outcome 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.