CausalDisco 🪩
CausalDisco provides baseline algorithms and analytics tools for Causal Discovery in Python. The package can be installed by running pip install CausalDisco. Additional information can be found in the documentation.
Baseline Algorithms
Find the following baseline algorithms in CausalDisco/baselines.py
- R²-SortnRegress
- Var-SortnRegress
- Random-SortnRegress
Analytics Tools
Find the following analytics tools in CausalDisco/analytics.py
- R²-sortability
- Var-sortability
- order_alignment
Sources
If you find our algorithms useful please consider citing
- Beware of the Simulated DAG!
- A Scale-Invariant Sorting Criterion to Find a Causal Order in Additive Noise Models.
@inproceedings{reisach2023scale,
title = {{A Scale-Invariant Sorting Criterion to Find a Causal Order in Additive Noise Models}},
author = {Alexander G. Reisach and Myriam Tami and Christof Seiler and Antoine Chambaz and Sebastian Weichwald},
booktitle = {{Advances in Neural Information Processing Systems 36 (NeurIPS)}},
year = {2023},
doi = {10.48550/arXiv.2303.18211},
}
@inproceedings{reisach2021beware,
title = {{Beware of the Simulated DAG! Causal Discovery Benchmarks May Be Easy to Game}},
author = {Alexander G. Reisach and Christof Seiler and Sebastian Weichwald},
booktitle = {{Advances in Neural Information Processing Systems 34 (NeurIPS)}},
year = {2021},
doi = {10.48550/arXiv.2102.13647},
}
A Simple Example
# --- sample data from a linear SCM:
import numpy as np
from scipy import linalg
d = 10
W = np.diag(np.ones(d-1), 1)
X = np.random.randn(10000, d).dot(linalg.inv(np.eye(d) - W))
X_std = (X - np.mean(X, axis=0))/np.std(X, axis=0)
# --- run analytics and print results:
from CausalDisco.analytics import (
var_sortability,
r2_sortability,
snr_sortability
)
print(
f'True\n{W}\n'
f'var-sortability={var_sortability(X, W):.2f}\n'
f'R^2-sortability={r2_sortability(X, W):.2f}\n'
f'SNR-sortability={snr_sortability(X, W):.2f}'
)
# --- run baselines and print results:
from CausalDisco.baselines import (
random_sort_regress,
var_sort_regress,
r2_sort_regress
)
print(
f'True\n{W}\n'
'--- randomRegress ---\n'
f'Recovered:\n{1.0*(random_sort_regress(X)!=0)}\n'
f'Recovered standardized:\n{1.0*(random_sort_regress(X_std)!=0)}\n'
'--- varSortnRegress ---\n'
f'Recovered:\n{1.0*(var_sort_regress(X)!=0)}\n'
f'Recovered standardized:\n{1.0*(var_sort_regress(X_std)!=0)}\n'
'--- r2SortnRegress ---\n'
f'Recovered:\n{1.0*(r2_sort_regress(X)!=0)}\n'
f'Recovered standardized:\n{1.0*(r2_sort_regress(X_std)!=0)}\n'
)
Shout out to Anne Helby Petersen for coming up with the "causal disco" naming idea first (check out her causalDisco package providing tools for causal discovery on observational data in R).
Metadata
Release files for CausalDisco 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| causaldisco-0.2.4.tar.gz | 6.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| causaldisco-0.2.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 15.2 kB
Release files / causaldisco-0.2.4.tar.gz
| Download URL | causaldisco-0.2.4.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a1e30ac242328e47a8c94f8f566c0c2c4e713670fe165ff99ed5b2d0528d09e
|
|
BLAKE2b-256 checksum How to use checksums |
7be6eae10fe473b935e7bb84b4e0cfbe55a9585963de621904efc34ed9a4c2b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / causaldisco-0.2.4-py2.py3-none-any.whl
| Download URL | causaldisco-0.2.4-py2.py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
006fd2269bbebf20f6ba5a51472ac5279611d98a3ce37562b6d031d3f385dea5
|
|
BLAKE2b-256 checksum How to use checksums |
216b57e023fc6b9c2b93b6f95b9a1c9b8e3bd377be6b45ec6e338b955c9dc3dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for CausalDisco 0.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.