Installation

causalig needs Python ≥ 3.10. Its only hard dependencies are PyTorch ≥ 2.0 and NumPy.

With conda

The repository ships an environment.yml that creates a causalig environment:

conda env create -f environment.yml
conda activate causalig
pip install -e ".[shap,experiments]"   # adds the extras needed for the paper's experiments

Optional extras

Extra

Installs

Needed for

shap

shap

The Shapley-value baselines CausalSHAP and ConditionalSHAP.

experiments

captum, sempler, matplotlib, scipy

Running experiments/ and scripts/, which reproduce the paper’s synthetic benchmark (see Reproducing the paper).

dev

pytest, pytest-cov, ruff, black, shap

Running the test suite and linters (see Development).

pip install -e ".[shap]"
pip install -e ".[experiments]"
pip install -e ".[dev]"

import causalig never imports shap: the SHAP baselines are loaded lazily the first time you access causalig.attr.CausalSHAP or causalig.attr.ConditionalSHAP.

Check the install

python -c "import causalig; print(causalig.__version__)"