Skip to main content

Andrey, a very fast causal discovery package

CI status Python 3.11, 3.12, 3.13, 3.14 License: Apache 2.0

Andrey is a causal discovery package for Python.

  • Fast: Over 100x faster on PC, and faster on most other supported methods.
  • Just as accurate: the same errors or fewer in 38 of 42 comparisons with other packages.
  • One API: 18 methods, each one function call.
  • Agent-ready: a command line that answers in JSON, and a skill for coding agents.
uv add andrey-core
  • With pip: pip install andrey-core
  • Optional extras: andrey-core[numba] for compiled CPU code, andrey-core[torch] for GPUs
  • Development version: uv add git+https://github.com/Abel-ai-lab/andrey
  • Installation guide: the extras, a PyTorch build for your GPU, and building Andrey from source

Andrey's speedup over the slowest package on the same data: PC 941x at 400 variables,
      FCI 8.7x at 800 variables, GES 4.3x at 150 variables, BOSS 3.4x at 800 variables, GRaSP
      1.4x at 400 variables, DirectLiNGAM 3.3x at 200 variables

Benchmark report

Four ideas make it fast; each is animated in a blog post:

  • Do many things at once: thousands of independence tests run as one array operation, with the same results.
  • Never compute twice: the correlation matrix is computed once and cached; GES memoizes its local scores.
  • Skip what can't matter: tests with a closed form settle most edges before any matrix is inverted.
  • Use the hardware you have: with the optional extras, Numba compiles GES's path checks and a GPU computes large tables.

What's inside

Family Methods Returns
Constraint-based pc, fci, gfci*, cdnod* CPDAG, PAG
Score-based ges, gies*, hc*, exact_search*, calm* CPDAG, DAG
Permutation-based boss, grasp CPDAG
Linear non-Gaussian direct_lingam, ica_lingam, multi_group_direct_lingam* DAG
Time series varma_lingam*, longitudinal_lingam* Temporal graph
Latent variables gin* DAG
Pairwise direction pnl* Two-node DAG

* Experimental: no published benchmark yet, and the API may change.

Quick start

Learn the protein-signalling network of Sachs et al. (2005) from 853 cells, and score it against the known network:

import andrey
from andrey.data import load_dataset
from andrey.metrics import score

sachs = load_dataset("sachs")  # 853 cells, 11 proteins, and the known network
out = andrey.pc(sachs.data)    # learn a graph
print(out)

scores = score(out.structure, sachs.graph)
print({k: round(scores[k], 2) for k in ("shd", "skeleton_precision", "skeleton_recall")})
PC  cpdag  |  11 nodes  |  8 edges (6 undirected, 2 directed)

  raf -- mek
  plc -- pip3
  pip2 -- pip3
  erk -- akt
  erk -- pka
  akt -- pka
  p38 -> pkc
  jnk -> pkc
{'shd': 11, 'skeleton_precision': 1.0, 'skeleton_recall': 0.47}

PC finds 8 edges, all among the known network's 17. The structural Hamming distance (SHD) counts the edges to add, remove, or reorient to reach the known network: 11 here (9 edges are missing, and 2 are oriented that the known network leaves undirected), and 17 for a graph with no edges.

For your own data, pass a pandas DataFrame or a NumPy array: one row per sample, one column per variable. From a shell or an agent:

andrey run pc --data your_data.csv   # JSON when piped, a summary in a terminal
andrey --skill                       # a guide an agent loads as a skill

Learn more

Andrey is in alpha: the API may change between releases, so pin the version you use. Linux is fully tested; macOS and Windows install and run on the CPU, but the full test suite and the GPU speedups (CUDA / MPS) are not tested there yet.

Citing, license, contributing

If you use Andrey in your work, please cite it, or use the citation file:

@software{andrey,
  author = {{Abel AI Lab}},
  title = {Andrey: A very fast causal discovery package},
  year = {2026},
  version = {0.1.0},
  url = {https://andrey.abel.ai},
}

Andrey is released under the Apache License 2.0. Bug reports and pull requests are welcome in the issue tracker; the contributing guide explains how to set up a development environment.

Andrey is inspired by causal-learn, pgmpy, Tetrad, and many other causal discovery packages.

Metadata

Release files for andrey-core 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for andrey-core 0.1.0
File Size Uploaded
andrey_core-0.1.0.tar.gz 283.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for andrey-core 0.1.0
File Interpreter ABI Platform
andrey_core-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 625.2 kB

Release files / andrey_core-0.1.0.tar.gz

Download URL andrey_core-0.1.0.tar.gz
Size 283.5 kB
Tags Source
SHA-256 checksum
How to use checksums
86e80c12c702a0e549df0578e763089704c657630dc71f784532638448e5906d
BLAKE2b-256 checksum
How to use checksums
63673fb8e5713a6608bf52caa76b35f34efd52082f3020f47e1a967901d48bfb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / andrey_core-0.1.0-py3-none-any.whl

Download URL andrey_core-0.1.0-py3-none-any.whl
Size 341.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5cff804615e4231ea1485aed6a9d280e169ac19287e7b4e233689ed584f7c9e
BLAKE2b-256 checksum
How to use checksums
fc519718e692483ea71564b54d71df150afcb416c11598488710169d9f761fc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page