This is the public repository of code implementation for KCRL: A Prior Knowledge Based Causal Discovery Framework With Reinforcement Learning.
The code is tested with the following configuration:
Python=3.6.10
, numpy=1.18.1
, pandas=1.0.1
, scikit-learn=0.22.1
, scipy=1.4.1
, tensorflow=1.13.1
, networkx
, pyyaml=5.3
, pytz=2019.3
, matplotlib=3.1.3
Test KCRL with any dataset:
python kcrl_demo.py
Detailed instructions:
- Set the initial parameters in the
kcrl_demo.py
file. - To use prior knowledge, provide the existing edges (0 or 1) in the prior knowledge matrix in
kcrl_demo.py
file. Detailed comments available in the file.
Our code has been benefited from the following existing works. We are really thankful to the corresponding authors.
DAGs With NOTEARS https://github.com/xunzheng/notears
Causal Discovery With Reinforcement Learning https://github.com/huawei-noah/trustworthyAI.git
gCastle package https://github.com/huawei-noah/trustworthyAI/tree/master/gcastle
Neural Combinatorial Optimization with RL https://github.com/MichelDeudon/neural-combinatorial-optimization-rl-tensorflow