Skip to content

wasimahmadpk/deepCause

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deep learning-based Causal Inference in Non-linear Multivariate Time series

This repository contains code for our paper accepted in ICMLA 2021: Causal Inference in Non-linear Time-series using Deep Networks and Knockoff Counterfactuals by Wasim Ahmad, Maha Shadaydeh and Joachim Denzler.

  • The work can be cited using below citation information.
@inproceedings{ahmad2021causal,
  title={Causal inference in non-linear time-series using deep networks and knockoff counterfactuals},
  author={Ahmad, Wasim and Shadaydeh, Maha and Denzler, Joachim},
  booktitle={2021 20th IEEE International Conference on Machine Learning and Applications (ICMLA)},
  pages={449--454},
  year={2021},
  organization={IEEE}
}

Overview

We model the non-linear relation in multivariate non-linear time series using deep networks and then generate counterfactuals with knockoffs to infer causality:

  1. First we train deep network using observational data.
  2. Then we generate knockoffs variables which we use as interventions on the trained model.
  3. We obtained counterfactual response from model when we replace model variables with knockoffs.
  4. For each pair variables {, } in nonlinear system, we apply hypthosis test on the mean of the residuals distribution $M_{res}$ of counterfactuals for multiple realization of the time series.
  5. Our NULL hypothesis is that variable does not cause , : $M_{res}$ == 0, else the alternate hypothesis : $M_{res}$ > 0 is accepted.

Data

We test our method on synthetic as well as real data which can be found under datasets/ directory. The synthetic data is generated using file src/synthetic_dataset.py. The real data we used is average daily discharges of rivers in the upper Danube basin, measurements of which are made available by the Bavarian Environmental Agency at https://www.gkd.bayern.de.

Code

src/main.py is our main file, where we model multivariate non-linear data using deep networks.

  • src/deepcause.py for actual and counterfactual outcome generation using interventions for causal inference.
  • src/knockoffs.py generate knockoffs of the original variables.
  • src/daignostics.py to determine the goodness of the generated knockoff copies.
  • DeepKnockoffs/ contains the knockoffs generation methods.
  • datasets/ contains the generated synthetic data and real dataset.
  • model/ contains trained models that we used for different datasets.

Dependencies

requirements.txt contains all the packages that are related to the project. To install them, simply create a new conda environment and type

pip install -r requirements.txt

Acknowledgement

This work is funded by the Carl Zeiss Foundation within the scope of the program line "Breakthroughs: Exploring Intelligent Systems" for "Digitization — explore the basics, use applications" and the DFG grant SH 1682/1-1.

About

Time series forecasting with DeepAR using GluonTS API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages