This is the code for the paper Jacobian-based Causal Discovery with Nonlinear ICA, demonstrating how identifiable representations (particularly, with Nonlinear ICA) can be used to extract the causal graph from an underlying structural equation model (SEM).
singularity build --fakeroot nv.sif nv.def
- First, you need to log into
wandb
wandb login #you will find your API key at https://wandb.ai/authorize
- Second, you need to specify the project for logging, which you can in the
before_fit
method in cli.py
def before_fit(self):
if isinstance(self.trainer.logger, WandbLogger) is True:
# required as the parser cannot parse the "-" symbol
self.trainer.logger.__dict__["_wandb_init"][
"entity"
] = "causal-representation-learning" # <--- modify this line
- Then, you can create and run the sweep
wandb sweep sweeps/sweep_file.yaml # returns sweep ID
wandb agent <ID-comes-here> --count=<number of runs> # when used on a cluster, set it to one and start multiple processes
- Clone
git clone https://github.com/rpatrik96/nl-causal-representations.git
- Install
# install package
pip3 install -e .
# install requirements
pip install -r requirements.txt
# install pre-commit hooks
pre-commit install
- Run:
python3 care_nl_ica/cli.py fit --config configs/config.yaml
Our repo extensively relies on cl-ica
repo, so please consider citing the corresponding paper as well
If you find our work useful, please consider citing our TMLR paper
@article{reizinger2023jacobianbased,
author = {
Reizinger, Patrik and
Sharma, Yash and
Bethge, Matthias and
Schölkopf, Bernhard and
Huszár, Ferenc and
Brendel, Wieland
},
title = {
Jacobian-based Causal Discovery with Nonlinear {ICA}
},
journal={Transactions on Machine Learning Research},
issn={2835-8856},
year={2023},
url={https://openreview.net/forum?id=2Yo9xqR6Ab},
}