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{Jin_2025,
doi = {10.3847/1538-4357/ad9ded},
url = {https://dx.doi.org/10.3847/1538-4357/ad9ded},
year = {2025},
month = {jan},
publisher = {The American Astronomical Society},
volume = {979},
number = {2},
pages = {212},
author = {Jin, Zehao and Pasquato, Mario and Davis, Benjamin L. and Deleu, Tristan and Luo, Yu and Cho, Changhyun and Lemos, Pablo and Perreault-Levasseur, Laurence and Bengio, Yoshua and Kang, Xi and Macciò, Andrea Valerio and Hezaveh, Yashar},
title = {Causal Discovery in Astrophysics: Unraveling Supermassive Black Hole and Galaxy Coevolution},
journal = {The Astrophysical Journal},
abstract = {Correlation does not imply causation, but patterns of statistical association between variables can be exploited to infer a causal structure (even with purely observational data) with the burgeoning field of causal discovery. As a purely observational science, astrophysics has much to gain by exploiting these new methods. The supermassive black hole (SMBH)–galaxy interaction has long been constrained by observed scaling relations, which is low-scatter correlations between variables such as SMBH mass and the central velocity dispersion of stars in a host galaxy's bulge. This study, using advanced causal discovery techniques and an up-to-date data set, reveals a causal link between galaxy properties and dynamically measured SMBH masses. We apply a score-based Bayesian framework to compute the exact conditional probabilities of every causal structure that could possibly describe our galaxy sample. With the exact posterior distribution, we determine the most likely causal structures and notice a probable causal reversal when separating galaxies by morphology. In elliptical galaxies, bulge properties (built from major mergers) tend to influence SMBH growth, while, in spiral galaxies, SMBHs are seen to affect host galaxy properties, potentially through feedback in gas-rich environments. For spiral galaxies, SMBHs progressively quench star formation, whereas, in elliptical galaxies, quenching is complete, and the causal connection has reversed. Our findings support theoretical models of hierarchical assembly of galaxies and active galactic nuclei feedback regulating galaxy evolution. Our study suggests the potentiality for further exploration of causal links in astrophysical and cosmological scaling relations, as well as any other observational science.}
}