This is the official implementation of CBRE in the paper “Cycle-Balanced Representation Learning For Counterfactual Inference”.
The code is built on the Counterfactual regression (CFR) and Adversarial Balancing based representation learning for Causal Effect Inference (ABCEI) . The random parameter searching, network training and evaluation follow the procedures of CFR to ensure a fair comparison.
We use Python 3.5.6 and Tensorflow==1.4.0. You can install libraries with requirements.txt.
pip install -r requirements.txt
Data: there are three datasets in this repository, and you can also download them from The website of Dr. Fredrik D. Johansson.
Configs: there are three config.txt for datasets.
The implementation of the CBRE network is included in cbre/cbre_net.py.
The training code is cbre_train.py, and you can test performance with different parameters by cbre_param_search.py.
The overall procedure is the same as cfrnet and abcei.
==You can replace the class CBRENet in cbre/cbre_net.py with your model.==
About how to use param_search and evaluate, you can refer to CFRnet. We use evaluate.py to test performance on the IHDP and Jobs datasets. And we assess the Twins dataset with evaluate_twins.py for our model and baselines.
Please consider citing this paper if it’s helpful for you.
@article{zhou2021cycle, title={Cycle-Balanced Representation Learning For Counterfactual Inference}, author={Zhou, Guanglin and Yao, Lina and Xu, Xiwei and Wang, Chen and Zhu, Liming}, journal={arXiv preprint arXiv:2110.15484}, year={2021} }