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}
}
We model the non-linear relation in multivariate non-linear time series using deep networks and then generate counterfactuals with knockoffs to infer causality:
- First we train deep network
using observational data.
- Then we generate knockoffs variables which we use as interventions on the trained model.
- We obtained counterfactual response from model when we replace model variables with knockoffs.
- 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. - Our NULL hypothesis is that variable
does not cause
,
:
$M_{res}$ == 0, else the alternate hypothesis:
$M_{res}$ > 0 is accepted.
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.
src/main.py is our main file, where we model multivariate non-linear data using deep networks.
src/deepcause.pyfor actual and counterfactual outcome generation using interventions for causal inference.src/knockoffs.pygenerate knockoffs of the original variables.src/daignostics.pyto 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.
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
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.