Skip to main content

Andrey, a very fast causal discovery package

PyPI version 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 1,000x faster on PNL, and faster on most other supported methods.
  • Just as accurate: as accurate as other popular packages on the same data.
  • One API: 24 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, XGES 140x at 200 variables, Tabu
      search 561x at 800 variables, DirectLiNGAM 3.3x at 200 variables

Release cards

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*, xges, hc, tabu, 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*, rcd, camuv*, bottom_up_parce_lingam DAG, PAG
Pairwise direction anm, pnl Two-node DAG

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

Quick start

Learn the protein-signaling 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.4.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.4.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.4.0
File Size Uploaded
andrey_core-0.4.0.tar.gz 308.3 kB Details

Built distribution (wheel)

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

Total release size: 675.7 kB

Release files / andrey_core-0.4.0.tar.gz

Download URL andrey_core-0.4.0.tar.gz
Size 308.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ce4c1c37fb5383397d1c7bf7d5fc8eb482298ce1ee194f489a4485afd948debf
BLAKE2b-256 checksum
How to use checksums
18166d60e2be8be2c053a86719161c509d7bf904405bee64ac5b627efa422b1d
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 15, 2026.

Transparency log

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

Download URL andrey_core-0.4.0-py3-none-any.whl
Size 367.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94b735915e505d2178be8c133677b07beb43d265bfb8be83234064e1c7768ca9
BLAKE2b-256 checksum
How to use checksums
c1efa2898bfe6e0544b9df0253560b309720c811000471f5ec09f3d97401db88
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 15, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.1

2 release files

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

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