[Paper Review] fairadapt: Causal Reasoning for Fair Data Pre-processing
fairadapt is an R package that implements a causal inference-based pre-processing method for fair machine learning, using counterfactual reasoning to adjust individual data points as if their sensitive attributes (e.g., gender, race) had been different. By applying recursive quantile matching within a structural causal model, it enables fair data adaptation while supporting resolving variables and Semi-Markovian models, reducing demographic disparity in outcomes without requiring model retraining.
Machine learning algorithms are useful for various predictions tasks, but they can also learn how to discriminate, based on gender, race or other sensitive attributes. This realization gave rise to the field of fair machine learning, which aims to measure and mitigate such algorithmic bias. This manuscript describes the R-package fairadapt, which implements a causal inference pre-processing method. By making use of a causal graphical model and the observed data, the method can be used to address hypothetical questions of the form "What would my salary have been, had I been of a different gender/race?". Such individual level counterfactual reasoning can help eliminate discrimination and help justify fair decisions. We also discuss appropriate relaxations which assume certain causal pathways from the sensitive attribute to the outcome are not discriminatory.
Motivation & Objective
- To address algorithmic bias in machine learning by enabling individual-level counterfactual reasoning about sensitive attributes.
- To provide a causal inference-based pre-processing method that adjusts data to mitigate unfair outcomes without retraining models.
- To implement a method that supports resolving variables and Semi-Markovian models, allowing for more realistic fairness assumptions.
- To offer a practical, open-source R package (fairadapt on CRAN) for fair data adaptation with theoretical grounding in structural causal models.
Proposed method
- Uses a structural causal model (SCM) to define counterfactual worlds where an individual’s sensitive attribute (e.g., gender) is hypothetically changed.
- Applies recursive quantile matching: for each individual, maps their observed values to equivalent quantiles in the distribution of the target group (e.g., females) for each variable in the causal chain.
- Employs potential outcomes notation to compute counterfactual values Y(fp) such that P(Y ≥ y | E=e, T=t, A=a') = P(Y ≥ y(fp) | E=e(fp), T=t(fp), A=a).
- Supports resolving variables, which relax the assumption of full demographic parity by allowing some discrimination if justified by observed data.
- Extends to Semi-Markovian models by incorporating latent variable confounding via bidirected edges, using extended parent sets (Pa(Vi)) for accurate quantile estimation.
- Implements identifiability checks based on Tian and Pearl (2002), rejecting interventions when not computable due to unblocked backdoor paths involving sensitive attributes or resolving variables.
Experimental results
Research questions
- RQ1Can counterfactual reasoning be used to fairly adjust individual data points to eliminate bias from sensitive attributes like gender or race?
- RQ2How can fair data adaptation be achieved without retraining machine learning models, using only pre-processing?
- RQ3To what extent can resolving variables allow for a more nuanced fairness definition that permits some non-discriminatory differences?
- RQ4What are the conditions under which counterfactual interventions are identifiable in causal models with latent confounding?
- RQ5How does the method perform in real-world data when applied to complex, interdependent causal structures?
Key findings
- The fairadapt package successfully reduces total variation in predicted outcomes between gender groups from -0.6757 to -0.4101 when using a resolving variable (test score), indicating a measurable reduction in disparity.
- The method enables individual-level counterfactual reasoning by computing transformed values that preserve relative standing within the target group, such as matching a male’s educational achievement to the equivalent percentile in the female distribution.
- The implementation supports both Markovian and Semi-Markovian models, with the latter allowing for latent confounding between variables like test score and final outcome.
- The package detects and prevents non-identifiable interventions, returning an error when backdoor paths involving sensitive attributes or resolving variables are unblocked.
- The method is extensible to topological ordering of variables, offering a flexible alternative to explicit parent set specification in complex models.
- fairadapt is the first CRAN package to implement a causal inference-based pre-processing method for fairness, filling a gap in available tools for fair machine learning.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.