Baseline algorithms and analytics tools for Causal Discovery.
Project description
CausalDisco 🪩
CausalDisco contains baseline algorithms and analytics tools for Causal Discovery. 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!
- Simple Sorting Criteria Help Find the Causal Order in Additive Noise Models.
@article{reisach2021beware,
title={Beware of the Simulated DAG! Causal Discovery Benchmarks May Be Easy to Game},
author={Reisach, Alexander G. and Seiler, Christof and Weichwald, Sebastian},
journal={Advances in Neural Information Processing Systems},
volume={34},
year={2021}
}
@article{reisach2023simple,
title={Simple Sorting Criteria Help Find the Causal Order in Additive Noise Models},
author={Reisach, Alexander G. and Tami, Myriam and Seiler, Christof and Chambaz, Antoine and Weichwald, Sebastian},
journal={arXiv preprint arXiv:2303.18211},
year={2023}
}
A Simple Example
# --- sample data from a linear SCM:
import numpy as np
from scipy import linalg
from CausalDisco.analytics import var_sortability, r2_sortability
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'
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file causaldisco-0.2.0.tar.gz.
File metadata
- Download URL: causaldisco-0.2.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1a120b99e4f773f73f26bf2f0de7e840f3224667f82b4e8698aea09c95ae0da
|
|
| MD5 |
e97460588b6063c0b51dfd9cd90c3213
|
|
| BLAKE2b-256 |
5c4f0b926c46d22f4348b65b38f28c163bf3f924e850295a36c0a0fda8f64ef4
|
File details
Details for the file causaldisco-0.2.0-py2.py3-none-any.whl.
File metadata
- Download URL: causaldisco-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95015817a806595279788645ec37bba5b4e42aace7b9fa9949bace2369c46a43
|
|
| MD5 |
db41f693a3c8f41e05f7071dc58ebb5c
|
|
| BLAKE2b-256 |
f165de0c5a284472ad2bfccf3827fb09cd16f9d2c5c700589daa44bf41f72687
|