This repository contains the code for the paper "Finding and Listing Front-door Adjustment Sets" by Hyunchai Jeong, Jin Tian, and Elias Bareinboim.
Please run the following commands to install the package:
git clone https://github.com/CausalAILab/FrontdoorAdjustmentSets.git
cd FrontdoorAdjustmentSets
pip install -r requirements.txt
pip install -e .
To run some examples, try running the following commands:
python3 main.py find graphs/fig1a.txt
python3 main.py list graphs/fig1b.txt
- First argument:
find
orlist
.find
is used for finding any valid front-door adjustment set. Specifylist
for enumerating all valid front-door adjustment sets. - Second argument:
graphs/fig1a.txt
. the path to a file that contains all necessary information, such as graph, query, and constraints (i.e.,I
andR
). Please check the formatting for details.
Consider graphs/fig1b.txt
as an example.
<NODES>
Each line represents the name of a variable/node (e.g., X
and A
).
<EDGES>
Each line describes an edge. Two types of edges are supported:
- Directed edge:
X -> A
represents a directed edge fromX
toA
. - Bidirected edge:
X -- Y
means there exists some unmeasured confounder (i.e., latent variable) betweenX
andY
.
<TASK>
The task represents the query of interest. The lines:
treatment: X
outcome: Y
specifies a casual effect from X
to Y
. Multiple nodes may be specified by separating each name of a node with comma (e.g., treatment: A, B, C
).
<CONSTRAINTS>
The lines:
I: B
R: A,B,C,D
represent the constraints as follows:
I
specifies a set of nodes that must be in any candidate front-door adjustment set. IfI
is not specifed (i.e., by removing the lineI: B
), thenI
will be an empty set by default.R
specifies a set of nodes that could be in any candidate front-door adjustment set. IfR
is not specifed (i.e., by removing the lineR: A,B,C,D
), then every node but treatment and outcome nodes will be included by default.