https://github.com/rpatrik96/nl-causal-representations
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).
https://github.com/rpatrik96/nl-causal-representations
causal-discovery causal-discovery-methods causal-inference causality deep-learning deep-neural-networks deeplearning ica independent-component-analysis machine-learning structural-causal-model
Last synced: 3 months ago
JSON representation
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).
- Host: GitHub
- URL: https://github.com/rpatrik96/nl-causal-representations
- Owner: rpatrik96
- License: mit
- Created: 2021-04-24T09:10:11.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-09-05T19:44:46.000Z (about 1 year ago)
- Last Synced: 2025-06-22T14:40:45.564Z (4 months ago)
- Topics: causal-discovery, causal-discovery-methods, causal-inference, causality, deep-learning, deep-neural-networks, deeplearning, ica, independent-component-analysis, machine-learning, structural-causal-model
- Language: Python
- Homepage:
- Size: 6.67 MB
- Stars: 18
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
[](https://doi.org/10.5281/zenodo.7002143)

[](https://github.com/pre-commit/pre-commit)# Jacobian-based Causal Discovery with Nonlinear ICA
## Description
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).## Before running the code
### Singularity container build
```bash
singularity build --fakeroot nv.sif nv.def
```### Logging
1. First, you need to log into `wandb`
```bash
wandb login #you will find your API key at https://wandb.ai/authorize
```2. Second, you need to specify the project for logging, which you can in the `before_fit` method in [cli.py](https://github.com/rpatrik96/nl-causal-representations/blob/master/care_nl_ica/cli.py#L37)
```python
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
```3. Then, you can create and run the sweep
```bash
wandb sweep sweeps/sweep_file.yaml # returns sweep ID
wandb agent --count= # when used on a cluster, set it to one and start multiple processes
```## Usage
1. Clone
```bash
git clone https://github.com/rpatrik96/nl-causal-representations.git
```2. Install
```bash
# install package
pip3 install -e .# install requirements
pip install -r requirements.txt# install pre-commit hooks
pre-commit install
```3. Run:
```bash
python3 care_nl_ica/cli.py fit --config configs/config.yaml
```### Code credits
Our repo extensively relies on `cl-ica` [repo](https://github.com/brendel-group/cl-ica), so please consider citing the corresponding [paper](http://proceedings.mlr.press/v139/zimmermann21a/zimmermann21a.pdf) as well# Reference
If you find our work useful, please consider citing our [TMLR paper](https://openreview.net/forum?id=2Yo9xqR6Ab)```bibtex
@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},
}
```