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 [17],recidivism predictions [10, 1] and ﬁnance [46, 20]), 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 [11].
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 [12], equalized odds [16],and predictive parity [7].
Built on the causal inference framework [32], the second group treats thepresence of causal effect of the sensitive attribute on the decision as discrimination [56, 21, 23, 53,52, 29, 49, 19, 3, 40, 57, 55, 22, 41, 47].
Among the causal fairness works, counterfactual fairness [23], which considers the causal effect ofsensitive attributes on the individual level, has received much attention.
Given the true causal graph,
Kusner et al.
[23] provide the conditions and algorithms for achieving counterfactual fairness inthe constructed predictive model.
Wu et al.
[49] and Chiappa [3] extend counterfactual fairness byconsidering path-speciﬁc effects.
When the counterfactual effect is unidentiﬁable, counterfactualfairness can be approximately achieved by lower and upper bounds of counterfactual effects [48]
Existing counterfactual fairness methods assume the availability of a causal directed acyclic graph(DAG) [31], 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 [44, 8, 43, 5, 42, 18, 54, 36, 35].
Unfortunately, without strong assumptionson the data generating process, such as linearity [42] and additive noise [18, 36], 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) [45, 5].
With additional background knowledge, we can discern more causaldirections, which can be represented by a maximally partially directed acyclic graph (MPDAG)
[27],but we still cannot obtain a unique causal DAG.
Following this augment, we have a natural question to answer: can we learn causal fairness with apartially known causal graph represented by MPDAG?
In a causal DAG, if a variable S has a causalpath to another variable T , then S is an ancestor of T and T is a descendant of S .
Counterfactualfairness deems the prediction to be counterfactually fair if it is a function of the non-descendants ofsensitive attributes [23], 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 [56, 3, 6, 48], 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 2) 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 causal graph is fully known with the assumption that the sensitive attributes can not have ancestorsin 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) [32] 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 , one for 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 [32, 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 [30].
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) [27], which can be obtained by applying Meek’s rules R1, R2, R3 and R4 in[27].
The Algorithm 1 in [34] 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 107 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 [23] is a fairness criterion based on SCM [32].
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) .
[23, 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.
[23, Lemma 1] Let G be the causal graph of the given model [Equation]
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 [44, 8, 4].
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, we can 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 [34] in MPDAGs where the preﬁx b - stands forbackground.
Deﬁnition 4.1 (b-possibly causal path, b-non-causal path) .
[34, Deﬁnition 3.1] Suppose p = Ö
S = 151 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.
[34] 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 extend the term critical set [14] in CPDAGs to b-critical set in MPDAGs.
Deﬁnition 4.2 (b-Critical Set) .
Let G be an MPDAG, S and T be two distinct vertices in G .
Theb-critical set of S with respect to T in G consists of all adjacent vertices of S lying on at least onechordless b-possibly causal path from S to T .
Based on Deﬁnition 4.2, we provide a sufﬁcient and necessary graphical condition in Lemma 4.3 foridentifying the deﬁnite ancestral relation between two 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 b-critical set of S with respect to T always contains a child of S in 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 b-critical set in the
MPDAG directly.
The graphical criterion in Lemma 4.4 has been proved by [14, Lemma 2] and [2,
Lemma 1] for CPDAGs.
We extend it to general MPDAGs here.
Lemma 4.4.
Let G be an MPDAG and S , T be two distinct vertices in G .
Denote by C the b-criticalset of 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 b-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 arrow into 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 b-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 b-critical set.
According to the deﬁnition of the b-critical set, we need to ﬁnd all chordless b-possibly causal pathsfrom the source variable to the target variable ﬁrst.
However, it is cumbersome to check whether apath is chordless, since it involves considering many edges not on the path.
In Proposition 4.7 wepropose a more efﬁcient way to ﬁnd b-critical sets by leveraging the relation between chordless pathand deﬁnite status 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 195 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 theb-critical 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 b-possibly causal path from thesource vertex to the target vertex, we enumerate b-possibly causal paths of deﬁnite status, excludingpaths that contain any chord where the source vertex is an end node.
The nodes adjacent to the sourcevertex on these paths constitute the desired b-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, Algorithm 1 shows how to efﬁciently ﬁnd the b-critical set of Sw.r.t.
T in an MPDAG G .
Given an MPDAG G , the source vertex S and the target vertex T , theoutput of Algorithm 1 is the b-critical set of S w.r.t.
T in G .
Using the breadth-ﬁrst-search algorithm,
Algorithm 1 searches b-possibly causal path of deﬁnite status without any chord ending in S from Sto T .
A detailed explanation of this algorithm is provided in Appendix D. Finally, we present Algorithm 2 to identify the type of ancestral relation.
We ﬁrst ﬁnd the b-criticalset C of S with respect to T .
When C
= o , there is no b-possibly causal path from S to T , so Tis a deﬁnite non-descendant of S .
When C j o , using Theorem 4.5, we can decide whether T is adeﬁnite descendant or a possible descendant of S .
Since in Algorithm 1, the same triple like ( ↵ ,  , ⌧ ) can only be visited at most once, where ↵ isa sibling or a child of S in the MPDAG G , ⌧ is a node on a b-possibly causal path of deﬁnitestatus from S to T without any chord ending in S , and  lies immediately before ⌧ on such path.
The complexity of Algorithm 1 in the worst case is O ( ∂ sib (
S, G ) + ch (
S, G ) ∂ ò ∂
E (
G ) ∂ ) , where∂
E (
G ) ∂ is the number of edges in G . Consequently, the computational complexity of Algorithm 2 is O ( ∂ sib ( S, G ) + ch (
S, G ) ∂ ò ∂
E ( G ) ∂ ) . do 12: Algorithm
∂
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 2 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 2 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 (possibly small) violation of counterfactual fairness.
5.2 Under root node assumption
Kusner et al.
[23, 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 some counterintuitive 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 6, see Appendix F.1.
For additional experiments based on non-linear structural equations andvarying proportion of possible background knowledge, please refer to Appendix F.6 and Appendix F.7,respectively.
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 donot 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 included in Appendix F.2.
[Table]
[Figure]
[Table]
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.
6.2 Real data
The UCI Student Performance Data Set [9] 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 [4], which is implemented by a general causal discovery software - TETRAD [37].
After uploading the preprocessed data, we can learn the CPDAG G ò .
The evolution of the CPDAG to
MPDAG is shown in Appendix F.3.
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.3.
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.4.
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.5.
Conclusion and discussions
In this paper, we have developed a general approach to achieve counterfactual fairness when the truecausal graph is unknown.
In order to select features that lead to counterfactual fairness, we proposea sufﬁcient and necessary condition and an efﬁcient algorithm to identify the ancestral relationsbetween any distinct vertices on an MPDAG, a Markov equivalence class of causal DAGs that canbe learnt from observational data and domain knowledge.
Furthermore, an intriguing ﬁnding isthat, under the assumption that the sensitive attribute can only be a root node in the graph, there isno possible descendant of the sensitive attribute, so that the fair features can be selected correctlywhatever the true DAG is.
Experiments on synthetic and real-world dataset show the effectivenessof our method.
Throughout this paper, we assume no selection bias and presence of confoundersbecause the causal discovery algorithms themselves will not work well in such challenging scenarios.
Therefore, an interesting future direction is to achieve counterfactual fairness on partially ancestralgraphs [38, 51].