https://github.com/rose-stl-lab/mcd
Implementation of the ICML 2024 paper "Discovering Mixtures of Structural Causal Models from Time Series Data"
https://github.com/rose-stl-lab/mcd
Last synced: about 1 year ago
JSON representation
Implementation of the ICML 2024 paper "Discovering Mixtures of Structural Causal Models from Time Series Data"
- Host: GitHub
- URL: https://github.com/rose-stl-lab/mcd
- Owner: Rose-STL-Lab
- Created: 2024-05-24T23:43:20.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-30T16:55:56.000Z (over 1 year ago)
- Last Synced: 2025-03-31T20:23:30.665Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 485 KB
- Stars: 21
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Discovering Mixtures of Structural Causal Models from Time Series Data
Implementation of the paper "Discovering Mixtures of Structural Causal Models from Time Series Data", to appear at ICML 2024, Vienna.
Mixture Causal Discovery (MCD) aims to infer multiple causal graphs from time-series data.
Model Overview
Results on the S&P100 dataset
## Requirements
- NVIDIA GPU with minimum CUDA 11.8 installed.
- Make sure you have `conda` installed.
## Setup
Create a conda environment and install the prerequisite packages:
```
conda create -n mcd python=3.9 -y && \
conda run --no-capture-output -n mcd pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 && \
conda run --no-capture-output -n mcd pip3 install lightning matplotlib numpy scikit-learn seaborn \
cdt wandb igraph pyro-ppl hydra-core yahoofinancials && \
```
You also need the `graphviz` library. This library can be installed on Ubuntu systems using the command:
```
sudo apt-get install -y git && \
sudo apt-get install -y graphviz graphviz-dev
```
For baselines:
```
conda create -n baselines python=3.8 -y && \
conda run --no-capture-output -n baselines pip3 install pygraphviz wandb tigramite hydra-core pyro-ppl lightning causalnex matplotlib cdt seaborn lingam
```
## Dataset generation
Generate the datasets using the script files in the `scripts/` folder.
- Linear synthetic dataset: Run `./scripts/generate_synthetic_datasets_linear.sh`
- Nonlinear synthetic dataset: Run `./scripts/generate_synthetic_datasets_nonlinear.sh`
- Netsim datasets: Run `./scripts/setup_netsim.sh`
- DREAM3: Run `./scripts/setup_dream3.sh`
- S&P100: Run `./scripts/generate_snp100.sh`
## Running the code
Change the name of the `wandb` project in the config file.
- Linear synthetic dataset: Run `python3 -m src.train +dataset=ER_ER_num_graphs__lag_2_dim__NoHistDep_0.5_linear_gaussian_con_1_seed_0_n_samples_1000 +synthetic=mcd_linear`. Change `` and `` to the correct setting.
- Nonlinear synthetic dataset: Run `python3 -m src.train +dataset=ER_ER_num_graphs__lag_2_dim__HistDep_0.5_mlp_spline_product_con_1_seed_0_n_samples_1000 +synthetic=mcd`. Change `` and `` to the correct setting.
- Netsim-mixture: Run `python3 -m src.train +dataset=netsim_15_200_permuted +netsim=mcd`
- DREAM3: Run `python3 -m src.train +dataset=dream3 +dream3=mcd`
- S&P100: Run `python3 -m src.train +dataset=snp100 +snp100=mcd`
Results are stored in the `results/` folder.
## Acknowledgement
We implemented some parts of our framework using code from [Project Causica](https://github.com/microsoft/causica).
## Citation
If you find this work useful, please consider citing us.
```
@inproceedings{varambally2024discovering,
author = {Varambally, Sumanth and Ma, Yi-An and Yu, Rose},
title = {Discovering Mixtures of Structural Causal Models from Time Series Data},
booktitle = {International Conference on Machine Learning, {ICML} 2024},
series = {Proceedings of Machine Learning Research},
year = {2024}
}
```