git clone [email protected]:ZehaoJin/causalbh.git
or
git clone https://github.com/ZehaoJin/causalbh.git
-
We highly recommand install dependencies in a virtual python environment via conda:
conda create --name causalbh conda activate causalbh
-
Install the GPU version of jax
-
To visualize causal graphs, perform analysis around causal graphs, install networkx, pygraphviz, and causallearn
-
some basic dependencies such as numpy, scipy, pandas, matplotlib, seaborn, tqdm
-
This repository has been tested on:
python 3.12.2 jax 0.4.24 networkx 3.1 pygraphviz 1.12 causallearn 0.1.3.8
exact posterior is not recommanded for number of nodes
- Run generate_all_dags.py. Specify the output location and number of nodes
$n$ in the script. It will take hours ~ days to run$n$ =7. - Or, use this multiprocessing version generate_all_dags_mp.py. It is also recommanded to verify the generated DAGs are valid using Verify_DAGs.ipynb if generated by the multiprocessing version
Follow marginals.ipynb to calculate exact posteriors, and plot edge/path marginals. It will take minutes ~ hours to run for
We here also offer a CPU version to calculate the BGe scores in the case without access to a GPU. After generating all possible DAGs, use cal_bge_cpu.py. This CPU approach is fairly fast for
We recommand using the causallearn implementation of PC and FCI alogrithm. Code example can be found here
When the exact posterior approach is computationally infeasible (usually
- A master catalog that covers 145 SMBHs and more than 100 galaxy properties can be found in SMBH_Data_03_15_24v2.csv
- Sub-catalogs used in this work is sliced from the master catalog. These catalog can be found in this folder. The main result of the paper comes from causal_BH_ell.csv, causal_BH_len.csv, and causal_BH_spr.csv.
- marginals_base+distance.ipynb: main result, and distance as a possible confounder
- marginals_SAM.ipynb: Semi-analytical models
- marginals_stds.ipynb: random sampling from observation errors
- marginals_LOO.ipynb: Leave-One-Out cross validation
- read_exact_posterior.ipynb: Plot causal graphs
- paper_plots_0305.ipynb: Plots related to DAG-GFN
If you use this repository or would like to refer the paper, please use the following BibTeX entry:
@article{
}