Git Product home page Git Product logo

rpatrik96 / nl-causal-representations Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 1.0 6.74 MB

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).

License: MIT License

Python 83.88% Dockerfile 0.55% Shell 1.54% Jupyter Notebook 14.03%
causal-discovery causal-discovery-methods causal-inference causality deep-learning deep-neural-networks deeplearning ica independent-component-analysis machine-learning

nl-causal-representations's Introduction

DOI

CI testing 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

singularity build --fakeroot nv.sif nv.def

Logging

  1. First, you need to log into wandb
wandb login #you will find your API key at https://wandb.ai/authorize
  1. 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
  1. 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

Usage

  1. Clone
 git clone https://github.com/rpatrik96/nl-causal-representations.git
  1. Install
# install package
pip3 install -e .

# install requirements 
pip install -r requirements.txt

# install pre-commit hooks
pre-commit install
  1. Run:
python3 care_nl_ica/cli.py fit --config configs/config.yaml

Code credits

Our repo extensively relies on cl-ica repo, so please consider citing the corresponding paper as well

Reference

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},
}

nl-causal-representations's People

Contributors

rpatrik96 avatar ysharma1126 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

vishalbelsare

nl-causal-representations's Issues

Using custom dataset

Hi! Thanks for the cool paper :) Do you have any recommendations on the easiest way to run your code on a custom dataset, say an N x D array of observations? Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.