Giter Club home page Giter Club logo

cf-ode's Introduction

Causal ODE package

This is the code repository of the AISTATS 2022 paper : "Predicting the impact of treatments over time with uncertainty awareneural differential equations."

Package and dependencies installation

We support both conda environments and poetry types of environments.

Conda

conda create --name causalode --file requirements.txt

Poetry

Poetry is a python dependencies manager. You can install it following the instructions here.

You can then install all the dependencies at once by running:

poetry install

Attention When using poetry as package dependencies, you'll have to add poetry run to your commands. Example:

poetry run python train_model.py

Run the code

To run the experiments from the paper, you can use the parametrizations below. All datasets are generated on the fly. The different folds were created by changing the seed parameter.

Harmonic Oscillator data set

python train_model.py --N_ts=1000 --batch_size=64 --continuous_treatment=True --embedding_dim=64 --gamma=8 --kl_param=0.001 --logger_type=wandb --max_epochs=2000 --num_samples=5 --propensity_scores=False --seed=44 --sigma_sde=0.1 --static=False --std_dev=False --variational=True

CardioVascular data set

python train_model.py --N_ts=1000 --batch_size=64 --continuous_treatment=True --dataset_name=cv --embedding_dim=64 --gamma=10 --horizon=10 --kl_param=0.001 --logger_type=wandb --max_epochs=2000 --num_samples=5 --propensity_scores=False --seed=44 --sigma_sde=0.1 --std_dev=False --variational=True

Dexamethasone data set

train_model.py --N_ts=1000 --batch_size=64 --continuous_treatment=True --dataset_name=covid --embedding_dim=64 --gamma=10 --horizon=10 --kl_param=0.001 --logger_type=wandb --max_epochs=2000 --num_samples=5 --propensity_scores=False --seed=43 --sigma_sde=0.1 --std_dev=False --variational=True

Process the results and make the figures

We provide jupyter notebooks to process the results of the experiments and generate the figures displayed in the paper.

  • Evaluation CFODE.ipynb

computes the results reported in Table 1 in the paper.

  • Figure 3.ipynb

creates the Figure 3 in the paper.

  • CostTreatment.ipynb

contains the experiments of section 5.3 about improving the treatment strategies with the derived uncertainties

  • OOD.ipynb

contains the scripts for the experiment on out-of-distribution sampels as reported in the Appendix.

Logging

All experiments have been logged with Weights and Biases but we also support MLFlow and Tensorboard. You change the type of logger by setting the --logger_type option.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

cf-ode's People

Contributors

edebrouwer avatar microsoftopensource avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cf-ode's Issues

Solving environment: failed

Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  • pyzmq==22.1.0=pypi_0
  • jmespath==0.10.0=pypi_0
  • sentry-sdk==1.1.0=pypi_0
  • entrypoints==0.3=pypi_0
  • cffi==1.14.5=pypi_0
  • itsdangerous==2.0.1=pypi_0
  • msrestazure==0.6.4=pypi_0
  • torchvision==0.9.1=py38_cu102
  • boltons==21.0.0=pypi_0
  • matplotlib-inline==0.1.2=pypi_0
  • pytorch==1.8.1=py3.8_cuda10.2_cudnn7.6.5_0
  • aiohttp==3.7.4.post0=pypi_0
  • sqlalchemy==1.4.15=pypi_0
  • nest-asyncio==1.5.1=pypi_0
  • grpcio==1.37.1=pypi_0
  • protobuf==3.17.0=pypi_0
  • async-generator==1.10=pypi_0
  • contextlib2==0.6.0.post1=pypi_0
  • azureml-core==1.28.0=pypi_0
  • defusedxml==0.7.1=pypi_0
  • future==0.18.2=pypi_0
  • markdown==3.3.4=pypi_0
  • pyopenssl==20.0.1=pypi_0
  • flask==2.0.1=pypi_0
  • docker-pycreds==0.4.0=pypi_0
  • urllib3==1.26.4=pypi_0
  • isodate==0.6.0=pypi_0
  • fsspec==2021.5.0=pypi_0
  • azureml-telemetry==1.28.0=pypi_0
  • adal==1.2.7=pypi_0
  • qtconsole==5.1.0=pypi_0
  • ruamel-yaml==0.17.4=pypi_0
  • python-editor==1.0.4=pypi_0
  • jupyterlab-pygments==0.1.2=pypi_0
  • widgetsnbextension==3.5.1=pypi_0
  • joblib==1.0.1=pypi_0
  • prompt-toolkit==3.0.18=pypi_0
  • pathtools==0.1.2=pypi_0
  • decorator==5.0.9=pypi_0
  • sqlparse==0.4.1=pypi_0
  • jupyter==1.0.0=pypi_0
  • azure-mgmt-storage==11.2.0=pypi_0
  • scikit-learn==0.24.2=pypi_0
  • pycparser==2.20=pypi_0
  • cryptography==3.4.7=pypi_0
  • requests-oauthlib==1.3.0=pypi_0
  • smmap==4.0.0=pypi_0
  • rsa==4.7.2=pypi_0
  • toml==0.10.2=pypi_0
  • azureml-train==1.28.0=pypi_0
  • webencodings==0.5.1=pypi_0
  • notebook==6.4.0=pypi_0
  • azure-mgmt-containerregistry==2.8.0=pypi_0
  • absl-py==0.12.0=pypi_0
  • configparser==5.0.2=pypi_0
  • google-auth==1.30.0=pypi_0
  • ipywidgets==7.6.3=pypi_0
  • jupyter-client==6.1.12=pypi_0
  • ruamel-yaml-clib==0.2.2=pypi_0
  • pyasn1-modules==0.2.8=pypi_0
  • traitlets==5.0.5=pypi_0
  • trampoline==0.1.2=pypi_0
  • nbconvert==6.0.7=pypi_0
  • azure-common==1.1.27=pypi_0
  • idna==2.10=pypi_0
  • docker==4.4.4=pypi_0
  • tqdm==4.60.0=pypi_0
  • gpytorch==1.5.0=pypi_0
  • gunicorn==20.1.0=pypi_0
  • azure-mgmt-authorization==0.61.0=pypi_0
  • backports-tempfile==1.0=pypi_0
  • ndg-httpsclient==0.5.1=pypi_0
  • parso==0.8.2=pypi_0
  • torchdiffeq==0.2.1=pypi_0
  • alembic==1.4.1=pypi_0
  • jedi==0.18.0=pypi_0
  • tensorboard-plugin-wit==1.8.0=pypi_0
  • ipython==7.23.1=pypi_0
  • mistune==0.8.4=pypi_0
  • shortuuid==1.0.1=pypi_0
  • pandocfilters==1.4.3=pypi_0
  • cachetools==4.2.2=pypi_0
  • secretstorage==3.3.1=pypi_0
  • pexpect==4.8.0=pypi_0
  • jupyterlab-widgets==1.0.0=pypi_0
  • gitdb==4.0.7=pypi_0
  • ptyprocess==0.7.0=pypi_0
  • pyasn1==0.4.8=pypi_0
  • applicationinsights==0.11.10=pypi_0
  • wandb==0.10.31=pypi_0
  • promise==2.3=pypi_0
  • pygments==2.9.0=pypi_0
  • pathspec==0.8.1=pypi_0
  • qtpy==1.9.0=pypi_0
  • torchsde==0.2.5=pypi_0
  • bleach==3.3.0=pypi_0
  • torchmetrics==0.3.2=pypi_0
  • yarl==1.6.3=pypi_0
  • pyjwt==2.1.0=pypi_0
  • terminado==0.10.0=pypi_0
  • pynvim==0.4.3=pypi_0
  • jupyter-core==4.7.1=pypi_0
  • requests==2.25.1=pypi_0
  • oauthlib==3.1.0=pypi_0
  • pickleshare==0.7.5=pypi_0
  • azureml-mlflow==1.28.0.post1=pypi_0
  • google-auth-oauthlib==0.4.4=pypi_0
  • threadpoolctl==2.1.0=pypi_0
  • wcwidth==0.2.5=pypi_0
  • jeepney==0.6.0=pypi_0
  • querystring-parser==1.2.4=pypi_0
  • jsonpickle==2.0.0=pypi_0
  • azure-graphrbac==0.61.1=pypi_0
  • nbformat==5.1.3=pypi_0
  • ipdb==0.13.7=pypi_0
  • tensorboard==2.4.1=pypi_0
  • prometheus-flask-exporter==0.18.2=pypi_0
  • msrest==0.6.21=pypi_0
  • torchaudio==0.8.1=py38
  • ipython-genutils==0.2.0=pypi_0
  • mako==1.1.4=pypi_0
  • jsonschema==3.2.0=pypi_0
  • argon2-cffi==20.1.0=pypi_0
  • gitpython==3.1.17=pypi_0
  • backcall==0.2.0=pypi_0
  • jupyter-console==6.4.0=pypi_0
  • ffmpeg==4.3=hf484d3e_0
  • azure-mgmt-keyvault==2.2.0=pypi_0
  • mlflow==1.17.0=pypi_0
  • werkzeug==2.0.1=pypi_0
  • azure-mgmt-resource==13.0.0=pypi_0
  • testpath==0.5.0=pypi_0
  • ipykernel==5.5.5=pypi_0
  • pydeprecate==0.3.0=pypi_0
  • pytorch-lightning==1.3.1=pypi_0
  • multidict==5.1.0=pypi_0
  • tabulate==0.8.9=pypi_0
  • chardet==4.0.0=pypi_0
  • greenlet==1.1.0=pypi_0
  • websocket-client==1.0.0=pypi_0
  • prometheus-client==0.10.1=pypi_0
  • backports-weakref==1.0.post1=pypi_0
  • pyrsistent==0.17.3=pypi_0
  • send2trash==1.5.0=pypi_0
  • subprocess32==3.5.4=pypi_0
  • async-timeout==3.0.1=pypi_0
  • databricks-cli==0.14.3=pypi_0
  • attrs==21.2.0=pypi_0
  • azureml-train-core==1.28.0=pypi_0
  • azureml-train-restclients-hyperdrive==1.28.0=pypi_0
  • nbclient==0.5.3=pypi_0

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.