Python code of causal discovery algorithm for causal graphs proposed in
Bayesian discovery of linear acyclic causal models
Hoyer, Patrik O., and Antti Hyttinen.
Conference on Uncertainty in Artificial Intelligence (UAI) 2009.
- numpy
- scipy
- sklearn
- itertools
- copy
We test the code using Anaconda 5.3.0 64-bit for python 2.7.15 on Windows 10. Any later version should still work perfectly.
After installing all required packages, you can run demo.py to see whether BayesLiNGAM could work normally.
The test code does the following:
- it generates 1000 observations (a (1000, 2) numpy array) from a causal model with 2 variables;
- BayesLiNGAM is applied on the generated data to infer the true causal graph.
mdl = BayesLiNGAM(X, B)
mdl.inference()
Class BayesLiNGAM()
Argument | Description |
---|---|
X | matrix of all instances, (n_samples, n_vars) numpy array |
B (optional) | true causal graph structure, (n_vars, n_vars) numpy array |
After the initialization of BayesLiNGAM()
object, use function self.inference()
to estimate the causal graph.
- Shoubo Hu - shoubo [dot] sub [at] gmail [dot] com
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details.