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 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: 21 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, DirectLiNGAM 3.3x at 200
      variables, RCD 2.5x at 24 observed variables, BottomUpParceLiNGAM 11x at 24 observed
      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*, 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*, rcd, camuv*, bottom_up_parce_lingam DAG, PAG
Pairwise direction 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.2.1},
  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.2.1

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.2.1
File Size Uploaded
andrey_core-0.2.1.tar.gz 290.5 kB Details

Built distribution (wheel)

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

Total release size: 639.6 kB

Release files / andrey_core-0.2.1.tar.gz

Download URL andrey_core-0.2.1.tar.gz
Size 290.5 kB
Tags Source
SHA-256 checksum
How to use checksums
63aae5396f04f1d06701ad522da9a91d30ca718b11914443deb913144150167c
BLAKE2b-256 checksum
How to use checksums
43697e05dc0ea25a6b4a1201a2f0e429e37052f4123d2bc097697267f8fde88d
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 12, 2026.

Transparency log

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

Download URL andrey_core-0.2.1-py3-none-any.whl
Size 349.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fcd7f3cf0e61ae70aa8c007a095fa38aa76975e2cecfc71fc4c616de67fd1f4c
BLAKE2b-256 checksum
How to use checksums
4c2924b9ce96038dcd69181e162da2b0c93b9d031e0463c98980bf08795cd50c
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 12, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.1 This release

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