Counterfactual Fairness with Partially Known Causal Graph
Abstract
Fair machine learning aims to avoid treating individuals or sub-populations unfavourably based on sensitive attributes , such as gender and race.
Those methodsin fair machine learning that are built on causal inference ascertain discriminationand bias through causal effects.
Though causality-based fair learning is attractingincreasing attention, current methods assume the true causal graph is fully known.
This paper proposes a general method to achieve the notion of counterfactualfairness when the true causal graph is unknown.
To be able to select featuresthat lead to counterfactual fairness, we derive the conditions and algorithms toidentify ancestral relations between variables on a Partially Directed Acyclic Graph(PDAG) , speciﬁcally, a class of causal DAGs that can be learned from observationaldata combined with domain knowledge.
Interestingly, we ﬁnd that counterfactualfairness can be achieved as if the true causal graph were fully known, when speciﬁcbackground knowledge is provided: the sensitive attributes do not have ancestorsin the causal graph.
Results on both simulated and real-world datasets demonstratethe effectiveness of our method.
Introduction
With the widespread application of machine learning in various ﬁelds (e g., hiring decisions [23],recidivism predictions [11, 1] and ﬁnance [55, 26]), the ethical and social impact of machine learningis receiving increasing attention.
In particular, machine learning algorithms are sensitive to the biasin training data, which may render their decisions discriminatory against individual or sub-populationgroup with respect to sensitive attributes , e g., gender and race.
For example, bias against AfricanAmericans was found with COMPAS, a decision support tool used by U
S. courts to assess thelikelihood of a defendant becoming a recidivist [12].
To achieve fair machine learning, a large body of methods have been proposed to mitigate biasaccording to different fairness measures.
These methods can be roughly categorized into two groups.
The ﬁrst group focuses on devising statistical fairness notions, which typically indicate the statisticaldiscrepancy between individuals or sub-populations, e.g., statistical parity [14], equalized odds [22],and predictive parity [8].
Built on the causal inference framework [40], the second group treats thepresence of causal effect of the sensitive attribute on the decision as discrimination [67, 27, 29, 64,63, 37, 59, 25, 4, 48, 68, 66, 28, 49, 57, 19].
While most of these work assume a known causal graph,
Galhotra et al.[19] study the problem of interventional fairness without assuming the access to theunderlying graph by utilizing conditional independence tests.
Among the causal fairness works, counterfactual fairness [29], which considers the causal effect ofsensitive attributes on the individual level, has received much attention.
Given the true causal graph,
Kusner et al.
[29] provide the conditions and algorithms for achieving counterfactual fairness inthe constructed predictive model
Wu et al.
[59] and Chiappa [4] extend counterfactual fairness by considering path-speciﬁc effects.
When the counterfactual effect is unidentiﬁable, counterfactualfairness can be approximately achieved by lower and upper bounds of counterfactual effects [58].
Existing counterfactual fairness methods assume the availability of a causal directed acyclic graph(DAG) [39], which encodes causal relationships between variables.
However, in many real-worldscenarios, the causal DAG is often unknown due to insufﬁcient understanding of the system underinvestigation.
An obvious path forward is to infer the causal DAG from observational data usingcausal discovery methods [53, 9, 52, 6, 51, 24, 65, 44, 43].
Unfortunately, without strong assumptionson the data generating process, such as linearity [51] and additive noise [24, 44], one cannot uniquelyrecover the underlying true causal graph from observational data alone.
In the general case, causaldiscovery methods could output a Markov equivalence class of DAGs that encode the same set ofconditional independencies from data, which can be represented by a completely partially directedacyclic graph (CPDAG) [54, 6].
With additional background knowledge, we can discern more causaldirections, which can be represented by a maximally partially directed acyclic graph (MPDAG)
[34],but we still cannot obtain a unique causal DAG.
Following this augment, we have a natural question to answer: can we learn counterfactual fairnesswith a partially known causal graph represented by MPDAG?
In a causal DAG, if a variable Shas a causal path to another variable T , then S is an ancestor of T and T is a descendant of S .
Counterfactual fairness deems the prediction to be counterfactually fair if it is a function of thenon-descendants of sensitive attributes [29], which are straightforward to identify in DAGs.
However,in an MPDAG, with respect to a variable S , a variable T can be either
• a deﬁnite descendant of S if T is a descendant of S in every equivalent DAG,
• a deﬁnite non-descendant of S if T is a non-descendant of S in every equivalent DAG,
• a possible descendant of S if T is neither a deﬁnite descendant nor a deﬁnite non-descendantof S .
To achieve counterfactual fairness in MPDAGs, we need to select the deﬁnite non-descendants andsome possible descendants of the sensitive attributes that could be non-descendants in the true DAGto make prediction.
This comes to the core challenge: the identiﬁability of the ancestral relationbetween two distinct variables in an MPDAG.
We refer the interested readers to a summary of existingidentiﬁability results in Appendix G.
In this paper, we assume no selection bias and presence of confounders because the causal discoveryalgorithms themselves will not work well in such challenging scenarios.
Under this assumption,which can also be found in the most related work [67, 4, 7, 58], but removing the assumption on a fullydirected causal DAG, we make the following main contributions towards achieving counterfactualfairness on MPDAGs:
• We provide a sufﬁcient and necessary graphical criterion (Theorem 4.5) to check whether a
variable is a deﬁnite descendant of another variable on an MPDAG;
• Based on the proposed criterion, we give an efﬁcient algorithm (Algorithm 1) to identifyancestral relations between any two variables on an MPDAG;
• We propose the ﬁrst approach for achieving counterfactual fairness on partially knowncausal graphs, speciﬁcally MPDAGs;
• We ﬁnd that on an MPDAG, counterfactual fairness can be achieved as if the true causalgraph is fully known with the assumption that the sensitive attributes can not have ancestors in the causal graph.
Background
In this section, we ﬁrst review the structural causal model, causal graph and counterfactual inference.
Then we introduce counterfactual fairness criterion and its intuitive implications.
2.1 Structural causal model, causal graph, and counterfactual inference
Structural causal model (SCM) [40] is a framework to model causal relations between variables.
It isdeﬁned by a triple (
U, V, F ) , where V are observable endogenous variables and U are unobservedexogenous variables that cannot be caused by any variable in V .
F is a set of functions f 1 , ..., f n , onefor each V i
" V expressing how V i is dependant on its direct causes: V i =
f i ( pa i , U i ) , where pa i isthe observed direct causes of V i and U i is the set of unobserved direct causes of V i .
The exogenous
U i s are required to be jointly independent.
The set of equations F induces a causal graph D overthe variables, usually in the form of a directed acyclic graph (DAG), where the directed causes of V irepresents its parent set in the causal graph.
Based on SCM, one can perform counterfactual inference to answer the problems in the counterfactualworld.
For example, consider in a fairness context, A , Y and X represent the sensitive attributes,outcome of interest, and other observable attributes, respectively.
For an individual U = u with
A = a, Y = y and X = x , a common counterfactual query is: “For this individual u , what wouldthe value of Y have been had A taken value a ¨ ”.
The solution, denoted as Y A ⇥ a ¨ ( u ) can be obtainedby three steps in the deterministic case: Abduction, Action and Prediction [40, Chapter 7.1].
Inprobabilistic counterfactual inference, the procedure can be modiﬁed to estimate the posterior of uand the distribution of Y A ⇥ a ¨ ( u ) .
DAGs, PDAGs and CPDAGs.
In a directed acyclic graph (DAG), all edges are directed and thereis no directed cycle in the graph; when some edges are undirected, we say it is a partially directedgraph (PDAG).
A DAG encodes a set of conditional independence relations based on the notiond-seperation [38].
Multiple DAGs are Markov equivalent if they encode the same set of conditionalindependence relations.
A Markov equivalence class of a DAG D can be uniquely represented by acompleted partially directed acyclic graph (CPDAG)
G ò , denoted by [
G ò ] .
MPDAGs.
The CPDAGs with background knowledge constraint is known as maximally oriented
PDAGs (MPDAGs) [34], which can be obtained by applying Meek’s rules R1, R2, R3 and R4 in[34].
The Algorithm 1 in [42] can be used to construct the MPDAG G from the CPDAG G ò andbackgroud knowledge B , where the background knowledge B is assumed to be the direct causal 109 information in the form X  Y , meaning that X is a direct cause of Y .
The subset of Markovequivalent DAGs consistent with the background knowledge B can be uniquely represented by an
MPDAG G , denoted by [
G ] .
Both a DAG and a CPDAG can be regarded as special cases of an
MPDAG when the background knowledge is completely known and not known, respectively.
2.2 Counterfactual fairness
Counterfactual fairness [29] is a fairness criterion based on SCM [40].
Let A , Y and X representthe sensitive attributes, outcome of interest and other observable attributes, respectively and theprediction of Y is denoted by ˆ Y .
For an individual with X = x and A = a , we say the prediction ˆ Yis counterfactually fair if it would have been the same had A been a ¨ in the counterfactual world as inthe real world that A is a .
Deﬁnition 2.1 (Counterfactual fairness) .
[29, Deﬁnition 5]
We say the prediction ˆ Y is counterfactually fair if under any context X = x and A = a ,
[Equation]
for all y and any value a ¨ attainable by A.
The deﬁnition of counterfactual fairness immediately suggests the following approach in Lemma 2.2to design a counterfactually fair model.
Lemma 2.2.
[29, Lemma 1] Let G be the causal graph of the given model (
U, V, F ) .
Then ˆ Y will becounterfactually fair if it is a function of the non-descendants of A .
Problem formulation
In this section, we introduce the task of achieving counterfactual fairness given PDAGs, especially
MPDAGs that can be learned from observational data using causal discovery algorithms [53, 9, 5].
Lemma 2.2 in Section 2.2 implies learning a counterfactually fair prediction can be framed as selectingthe non-descendants of A to predict Y .
If a causal DAG is used to encode the causal relations of allattributes, ﬁnding all non-descendants of A is straightforward.
However, as mentioned in Section 1,given observational data and optional background knowledge about direct causal information, wecan only learn a CPDAG or an MPDAG G , instead of the true DAG D " [
G ] .
Unfortunately, not allancestral relations between A and attributes in X are identiﬁable in a CPDAG or MPDAG.
Therefore, to achieve counterfactually fair prediction, we have two problems to solve:
• Identify the type of ancestral relations of any other attributes with A in G , i e. , identifying
the deﬁnite non-descendants, deﬁnite descendants, and possible descendants of A in an
MPDAG (Section 4);
• Build a counterfactually fair model based on the identiﬁed ancestral relations (Section 5).
Identiﬁability of ancestral relations in MPDAGs
In this section, we give a sufﬁcient and necessary graphical criterion on identifying the deﬁniteancestral relations between two distinct vertices in an MPDAG.
We also provide an efﬁcient algorithmfor implementing the proposed criterion.
We denote the parents, children, siblings and adjacencies ofthe node W in a graph G as pa (
W, G ) , ch (
W, G ) , sib (
W, G ) and adj (
W, G ) , respectively.
A chordof a path in G is any edge joining two non-consecutive vertices on the path.
A path without any chordis called chordless path .
In a graph G = (
V, E ) , where V and E represent the node set and edge setin G , the induced subgraph of G over V ¨ L V is the graph with vertex V ¨ and edges between verticesin V ¨ , that is E ¨ L E .
A graph is complete if any two distinct vertices are adjacent.
4.1 Graphical criterion on identifying ancestral relations in MPDAGs
We ﬁrst introduce the term b-possibly causal path [42] in MPDAGs where the preﬁx b - stands forbackground.
Deﬁnition 4.1 (b-possibly causal path, b-non-causal path) .
[42, Deﬁnition 3.1] Suppose p = Ö
S = 153 V 0 , ..., V k = T ã is a path from S to T in an MPDAG G , p is b-possibly causal in G if and only if noedge V
i ⇥ V j , 0 & i & j & k is in G , including the edge not on p .
Otherwise, p is a b-non-causalpath in G .
Perkovi´c et al.
[42] state that T is a deﬁnite non-descendant of S in an MPDAG G
if and only if thereis no b-possibly causal path from S to T in G .
In this section, to identify whether T is a deﬁnitedescendant of S in an MPDAG, we provide a sufﬁcient and necessary condition.
We introduce the term critical set [15] in CPDAGs as follows.
Deﬁnition 4.2 (Critical Set) .
[15, Deﬁnition 2] Let G be an CPDAG, S and T be two distinct verticesin G .
The critical set of S with respect to T in G consists of all adjacent vertices of S lying on at leastone chordless possibly causal path from S to T .
Deﬁnition 4.2 can be extended to MPDAGs directly, based on which, we provide a sufﬁcient andnecessary graphical condition in Lemma 4.3 for identifying the deﬁnite ancestral relation betweentwo distinct vertices in an MPDAG.
Lemma 4.3.
Let G be an MPDAG and S , T be two distinct vertices in G , then T is a deﬁnitedescendant of S in G if and only if the critical set of S with respect to T always contains a child of Sin every DAG D " [
G ] .
The proof of Lemma 4.3 is in Appendix B.1.
Note that we have to enumerate all Markov equivalent
DAGs for checking the condition given in Lemma 4.3.
To resolve this problem, we provide acondition in Lemma 4.4 to check the graphical characteristic of the corresponding critical set in the
MPDAG directly.
The graphical criterion in Lemma 4.4 has been proved by [16, Lemma 2] and [3,
Lemma 1] for CPDAGs.
We extend it to general MPDAGs here.
But notice that as a special case of MPDAG, CPDAG contain less information regarding the causalrelationships than MPDAGs do.
The additional information owned by MPDAGs has not beencompletely exploited in practice due to the fact that causal procedures that are valid to CPDAGs are not directly applicable to general MPDAGs.
For example, the CPDAGs can include partially directedcycles while MPDAGs cannot.
More details about the challenges and distinctions in working with MPDAGs, as opposed to CPDAGs can be referred to [42]. To tackle the challenge, we develop thegraphical criterion for the general MPDAG in Lemma 4.4. Lemma 4.4.
Let G be an MPDAG and S , T be two distinct vertices in G .
Denote by C the critical setof S with respect to T in G , then C = ch (
S, D )
=
o for some DAG D " [
G ] , if and only if C
= o ,or C induces a complete subgraph of G but C = ch (
S, G ) = o .
The proof of Lemma 4.4 is in Appendix B.2.
Building on Lemma 4.3 and Lemma 4.4, we arrived atthe desired sufﬁcient and necessary graphical criterion in Theorem 4.5.
Theorem 4.5.
Let S and T be two distinct vertices in an MPDAG G , and C be the critical set of Swith respect to T in G .
Then T is a deﬁnite descendant of S if and only if either S has a deﬁnite arrowinto C , that is
C = ch (
S, G ) j o , or S does not have a deﬁnite arrow into C but C is non-emptyand induces an incomplete subgraph of G .
With Theorem 4.5, we can identify whether T is a deﬁnite descendant of S in an MPDAG byﬁnding all chordless b-possibly causal path from S to T and checking graphical characteristic of thecorresponding critical set.
We provide an example to illustrate Theorem 4.5 in Appendix C.4.2 Algorithms
Here we provide an efﬁcient algorithm to identify the ancestral relation between any two distinctvertices in an MPDAG based on the theoretical results in Theorem 4.5.
It is straightforward to identifythe non-ancestral relation by checking if there exists a b-possibly causal path from the source to thetarget.
However, discriminating between a deﬁnite ancestral relation and a possible ancestral relationin an MPDAG by Theorem 4.5 requires ﬁnding the critical set.
According to the deﬁnition of the critical set, we need to ﬁnd all chordless possibly causal paths fromthe source variable to the target variable ﬁrst.
However, it is cumbersome to check whether a path ischordless, since it involves considering many edges not on the path.
In Proposition 4.7 we propose amore efﬁcient way to ﬁnd critical sets by leveraging the relation between chordless path and deﬁnitestatus path in Lemma 4.6.
We ﬁrst provide the notion of collider and deﬁnite status path .
Colliders and Deﬁnite Status paths.
In a path p
= Ö
S =
V 0 , ...,
V k = T ã , if V i  1  V i and 205 V i ⇥
V i + 1 , then we say V i is a collider on p .
If V i  1 and V i + 1 are not adjacent, then the tripleÖ
V i  1 , V i ,
V
i +ã is called a v-structure collided on V i , and V i can be called unshielded collider .
A node V i is a deﬁnite non-collider on a path p if there is at least one edge out of V i on p or
V i  1  V i
V
i + 1 is a subpath of p and V i  1 is not adjacent with V i
+ 1 .
A node is of deﬁnite statuson a path if it is a collider, a deﬁnite non-collider or an endpoint on the path.
A path p is of deﬁnitestatus if every node on p is of deﬁnite status.
Lemma 4.6.
Let S and T be two distinct vertices in an MPDAG G .
If p is a chordless path from S to
T in G , then p is of deﬁnite status.
Proposition 4.7.
Let G be an MPDAG, S and T be two distinct vertices in G .
Denote by C ST thecritical set of S with respect to T in G , then C ST = F ST , where F ST denotes all adjacent verticesof S lying on at least one b-possibly causal path of deﬁnite status from S to T in G that there is nochord with S as an endpoint.
Proposition 4.7 implies that, instead of enumerating all chordless possibly causal path from the sourcevertex to the target vertex, we enumerate b-possibly causal paths of deﬁnite status, excluding pathsthat contain any chord where the source vertex is an end node.
The nodes adjacent to the sourcevertex on these paths constitute the desired critical set.
The proof of Lemma 4.6 and Proposition 4.7 are in Appendix B.4 and Appendix B.5, respectively.
Following from Proposition 4.7, we develop Algorithm 3 showing how to efﬁciently ﬁnd the criticalset of S w.r.t.
T in an MPDAG G .
The speciﬁc Algorithm 3 and a detailed explanation of thisalgorithm is provided in Appendix D. Finally, we present Algorithm 1 to identify the type of ancestralrelation.
We ﬁrst ﬁnd the critical set C of S with respect to T .
When C
= o , there is no b-possiblycausal path from S to T , so T is a deﬁnite non-descendant of S .
When C j o , using Theorem 4.5,we can decide whether T is a deﬁnite descendant or a possible descendant of S .
Algorithm 1 Identify the type of ancestral relation of S with respect to T in an MPDAG
Since the complexity of Algorithm 3 in the worst case is O ( ∂ sib (
S, G ) + ch (
S, G ) ∂ ò ∂
E (
G ) ∂ ) , where∂
E (
G ) ∂ is the number of edges in G (see Appendix D), the computational complexity of Algorithm 1is therefore O
[Equation]
Counterfactual fairness in MPDAGs
Now, we return to our problem of learning counterfactually fair models via selecting features from
X .
We will consider two cases: 1) a general MPDAG and 2) an MPDAG learned with backgroundknowledge that A is a root node.
5.1 General case
We can identify the set of deﬁnite descendants, possible descendants and deﬁnite non-descendants ofthe sensitive attribute by simply applying Algorithm 1 to each pair of sensitive and any other attribute,which is concluded in Algorithm 4.
The detailed description of Algorithm 4 is provided in Appendix E.
As the computational complexity of Algorithm 1 in the worst case is O ( ∂ sib (
S, G ) + ch (
S, G ) ∂ ò∂
E (
G ) ∂ )
, the complexity of Algorithm 4 is directly O ( ∂ sib (
S, G ) + ch (
S, G ) ∂ ò ∂
E (
G )
∂
ò ∂
V (
G ) ∂ ) ,where ∂
E (
G ) ∂ is the number of edges and ∂
V (
G ) ∂ is the number of nodes in G .
We consider twofeature selection methods.
The ﬁrst method (called Fair ) only selects the deﬁnite non-descendants,which ensures counterfactual fairness.
However, the number of deﬁnite non-descendants in an
MPDAG might be too small, resulting in low prediction accuracy.
Therefore, we also propose asecond method (called FairRelax ), which uses possible descendants of A to increase the predictionaccuracy at the cost of a violation of counterfactual fairness.
5.2 Under root node assumption
Kusner et al.
[29, Section 3.2] mentioned the ancestral closure of sensitive attributes, meaning thattypically we should expect the sensitive attribute set A to be closed under ancestral relationships givenby the causal graph.
For instance, in the example that religion can be affected by the geographicalplace of origin, if religion is a sensitive attribute and geographical place of origin is a parent ofreligion , then it should also be in A .
Therefore, A will be the root node in most cases except somecounterintuitive scenarios.
Thus, we consider the following assumption, which is often true inreal-world datasets.
Assumption 5.1.
The sensitive attribute can only be a root node in a causal MPDAG.
For example, ‘sex’ cannot be caused by factors like ‘education’ and ‘salary’.
In an MPDAG G , given
Assumption 5.1, the ancestral relation between the sensitive attribute and any other attribute is fullyidentiﬁed, as shown in the following proposition.
Proposition 5.2.
In a MPDAG G with sensitive attribute A , if Assumption 5.1 holds, then any otherattribute is either a deﬁnite descendant or deﬁnite non-descendant of A .
Moreover, an arbitraryattribute W is a deﬁnite descendant of A if and only if there is a causal path from A to W in G .
The proof of Proposition 5.2 is in Appendix B.6.
From Proposition 5.2, it is very interesting to seethat ﬁtting a model with the deﬁnite non-descendants of A in G is exactly the same thing as ﬁtting amodel with the non-descendants of A in the true DAG D .
Thus, the counterfactual fairness can beachieved as if the true causal DAG is fully known.
Under Assumption 5.1, since there is a causal path from A to any deﬁnite descendant of A , we candirectly identify whether a target attribute is a descendants of A by checking if there is a causal pathfrom A to the target.
To ﬁnd all deﬁnite descendants in an MPDAG, we can use a breath ﬁrst searchalgorithm with computational complexity O ( ∂
V ∂ + ∂
E ∂ ) , where ∂
V ∂ is the number of nodes and ∂
E ∂ is the number of edges in G .
Then the remaining nodes are deﬁnite non-descendants of A in G .
Experiment
In this section, we illustrate our approach on a simulated and a real-world dataset by evaluating theprediction performance and fairness of our approach.
The prediction performance is evaluated by rootmean squared error (RMSE).
The counterfactual unfairness can be measured by the discrepancy ofthe predictions in the real world and counterfactual world for each individual.
In addition, unfairnesscan also be revealed by comparing the distributions of the predictions in two worlds, which coincideif the prediction is counterfactually fair.
Baselines.
We consider three baselines: 1) Full is a standard model that uses all attributes, includingthe sensitive attributes to make predictions, 2) Unaware is a model that uses all attributes except thesensitive attributes to make predictions, and 3) Oracle is a model that makes predictions with allattributes that are non-descendants of the sensitive attribute given the groundtruth DAG.
As mentionedin Section 5, our proposed methods include FairRelax , which makes predictions using all deﬁnitenon-descendants and possible descendants of the sensitive attribute in an MPDAG, and Fair , whichmakes predictions using all deﬁnite non-descendants of the sensitive attribute in an MPDAG.
6.1 Synthetic data
The synthetic data is generated from linear structural equation models according to a random DAG.
As the simulated DAG is known, we obtain the CPDAG from the true DAG without running the causaldiscovery algorithms.
2 We also add background knowledge to turn a CPDAG into its corresponding
MDPAG.
We ﬁrst randomly generate DAGs with d nodes and 2 ✓ d directed edges from the graphical model
Erd˝os-Rényi (ER), where d is chosen from { 10 , 20 , 30 ,} .
For each setting, we generate
DAGs.
For each DAG D , two nodes are randomly chosen as the outcome and the sensitive attribute,respectively.
The sensitive attribute can have two or three values, drawn from a Binomial([0,1]) or
Multinomial([0,1,2]) distribution separately.
The weight,  ij , of each directed edges X
i  X j in thegenerated DAG, is drawn from a Uniform( [  2 ,  0 .] <
5 ,] ) distribution.
The data are generatedaccording to the following linear structural equation model:
[Equation]
where ✏ 1 , ..., ✏ n are independent N ( 0 , 1 .)
Then we generate one sample with size 1000 for each
DAG.
The proportion of training and test data is splitted as 0 . 8 ⇥ 0 .
Once the CPDAG G ò isobtained, where D " [
G ò ] , we randomly generate the direct causal information A  B as thebackground knowledge from the edges where A  B is in DAG D , while A  B is in CPDAG G ò .
We show a randomly generated DAG D , the corresponding CPDAG G ò and MPDAG G as in Figure 7,see Appendix F.1.
For additional experiments based on more complicated structural equations andvarying amount of possible background knowledge, please refer to Appendix F.5 and Appendix F.6. We also analyze the model robustness experimentally on causal discovery algorithms in Appendix F.7.
Counterfactual fairness.
According to the predeﬁned linear causal model, we ﬁrst generate thecounterfactual data given counterfactual sensitive attributes.
For each individual, the noise of anycounterfactual feature is the same as that in the observational data.
In order to evaluate the counterfactual fairness of the baseline methods, we sample data from both the original and counterfactual dataand ﬁt them with all the models.
Here, unfairness can be measured by the absolute difference of twopredictions, ˆ Y A ⇥ a ( u ) and ˆ Y A ⇥ a ¨ ( u ) .
The results for each model with different graph settings areshown in Table 1 and Figure 1a.
Obviously, Oracle and Fair is counterfactually fair, since they do not use any feature that is causally dependant on the sensitive attribute.
Full and Unaware have highcounterfactual unfairness, while our FairRelax has very low counterfactual unfairness.
Additionally,when the model is counterfactually fair, the distributions of the predictions in two worlds shouldlie on top of each other, as in the Oracle and Fair models.
Although counterfactual unfairness isexhibited in the other three models, FairRelax is closer to strictly counterfactually fair methods.
Anexemplary density plot of the predictions of all the models in one original and counterfactual datasetis shown in Figure 2.
[Table]
[Figure]
[Table]
[Figure] [Table] [Figure] [Figure]
counterfactual
[Figure] [Figure] ( u ) in synthetic data. Accuracy.
For each graph setting, we report average RMSE achieved on 100 causal graphs by ﬁttinga linear regression model for the baselines and our proposed models in Table 1 and Figure 1b.
We canobserve that, for each graph setting, the Full model obtains the lowest RMSE, which is not surprisingas it uses all features.
In addition, our FairRelax methods obtains better accuracy than the strictlycounterfactually fair methods Fair and Oracle , which is consistent with the accuracy-fairnesstrade-off phenomenon.
More discussion on accuracy-fairness trade-off is included in Appendix H. [Table]
6.2 Real data
The UCI Student Performance Data Set [10] regarding students performance in Mathematics is usedin this experiment.
The data attributes include student grade in secondary education, demographic,social, and school related features.
It contains 395 students records with 32 attributes.
We regardsex as the sensitive attribute in this dataset.
Besides, we remove the ﬁrst, second and ﬁnal periodgrade, denoted by G1,G2 , and G3 in the dataset and generate the value of target attribute Grade asthe average of G1,G2 , and G3 .
In this section, we ﬁrst learn the corresponding CPDAG from this dataset leveraging the GES structurelearning algorithm [5], which is implemented by a general causal discovery software - TETRAD [45].
After uploading the preprocessed data, we can learn the CPDAG G ò .
The evolution of the CPDAG to
MPDAG is shown in Appendix F.2.
Our experiments are carried out under the root node assumption on the MPDAG G in Figure 8c, assex cannot be caused by other variables in the dataset.
Due to the space limit, Figure 8c is providedin Appendix F.2.
Thus, the ancestral relations can be fully identiﬁed according to our theoreticalresults in Section 5.2.
Our algorithm will ﬁnd all the non-descendants of the sensitive attribute.
Onthis dataset, the deﬁnite descendants of sex can be identiﬁed as {Walc, goout, Dalc, studytime} and allthe other nodes are deﬁnite non-descendants of sex .
The counterfactual fairness and accuracy are measured in almost the same way as in Section 6.1.
Thedetails on counterfactual data generation and model ﬁtting can be referred to Appendix F.3.
Theresults are reported in Table 2.
Since under the root node assumption, there is no possible descendantsof the sensitive attribute, the model Fair and FairRelax give the same RMSE result and both ofthem achieve counterfactual fairness at the cost of slight accuracy decrease.
Instead, the model Fulland Unaware are unfair and the Full model is more unfair than Unaware .
Besides, the distributionof predictions for the original and counterfactual data for all models have the same trend as thesynthetic data.
The corresponding density plot is included in Appendix F.4.
Conclusion and discussions
In this paper, we have developed a general approach to achieve counterfactual fairness when thetrue causal graph is unknown.
In order to select features that lead to counterfactual fairness, wepropose a sufﬁcient and necessary condition and an efﬁcient algorithm to identify the ancestralrelations between any distinct vertices on an MPDAG, which may be applied to more applications.
Furthermore, an intriguing ﬁnding is that, under the assumption that the sensitive attribute can onlybe a root node in the graph, there is no possible descendant of the sensitive attribute, so that the fairfeatures can be selected correctly whatever the true DAG is.
Experiments on synthetic and real-worlddataset show the effectiveness of our method.
Following prior work on establishing counterfactual fairness [67, 4, 7, 58], we assume no selectionbias and the presence of confounders throughout this paper.
Yet, another fundamental assumption inthese earlier studies in causal modelling is that the causal graph is known, which offers a new chancefor the bias induced by misspecifying the causal DAG.
In contrast, our work gives the ﬁrst method toachieve counterfactual fairness without requiring the causal DAG to be speciﬁed. In the presenceof selection bias and confounders on a causal DAG, a counterfactual fairness measure degeneratesto demographic parity, which is discussed extensively by Fawkes et al. In this situation, itis considerably more difﬁcult to provide a clear causal interpretation without specifying the causal DAG.
This gives rise to an exciting topic to research in future work. Exploring causal discoveryalgorithms to ﬁnd the ground-truth causal graph in the presence of selection bias and confoundersand then achieving counterfactual fairness on partially ancestral graphs [46, 62], which would besigniﬁcantly more difﬁcult, is another possible future direction.