CausalNex, a toolkit for causal reasoning
07 Apr 2020CausalNex is a library
developped by QuantumBlack to facilitate the causal analysis of a dataset. At
its root, CausalNex relies on Bayesian Networks.
For more on Bayesian Networks, have a look at
Wikipedia and a
tutorial by Kevin Murphy.
The training of these Bayesian
Networks (causal inference) uses the algorithm introduced in the paper DAGs
with NO TEARS.
Installation
The documentation is pretty clear.
The library can be easily installed by doing pip install causalnex.
Note that for some reason (not clear to me), we can’t install via poetry.
Also, causalnex requires pandas=0.24.0, which seems to be a problem with the
current project.
Last, but not least, causalnex requires the library pygraphviz which has to
be installed separately. And of course, pip install pygraphviz returns an
error. I ended up having to install everything but causalnex via conda the
pip install causalnex. But this may not be convenient for everyone, and it’s
weird that the library is so finicky.
Tutorial
The documentation contains (for now) a single tutorial that I will go through. The first thing we need to do is download the dataset, and unzip it.
[causality
python
]