Introducing Andrey#

Cover: portraits of Andrey Markov and Andrey Kolmogorov, side by side, drawn in navy lines
Andrey Markov and Andrey Kolmogorov.

We’re happy to introduce Andrey, a very fast causal discovery package for Python.

Andrey is named after Andrey Markov and Andrey Kolmogorov, whose ideas causal discovery still runs on (where the name comes from).

Most data analysis tells you which variables move together. Causal discovery learns from data which ones drive which, and draws them as a graph of causes. As AI systems take on more analysis and make decisions of their own, they need to know what causes what.

For a long time, scale has held causal discovery back. The methods are well understood, but popular Python packages run them slowly. PC on 400 variables took 617 s in causal-learn. At that speed, trying a new idea takes time, and data with thousands of variables is out of reach.

We built Andrey to make causal discovery fast and easy to use. It runs the same methods faster (over 100x on PC).

  • 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.

Speedup 400 variables800 variables150 variables800 variables400 variables200 variablesBenchmark report
Method
Andrey941x
gCastle3.7x
causal-learn1x
Andrey8.7x
causal-learn1x
Andrey4.3x
causal-learn1x
Andrey3.4x
causal-learn1x
Andrey1.4x
causal-learn1x
Andrey3.3x
causal-learn1x

Why Andrey is fast explains the four ideas behind the speed. Andrey is free and open source, and so are its benchmarks, which you can rerun yourself.

What’s next#

We plan to add more methods, including more for time series. We also plan to add local causal discovery, which finds the structure around one variable, such as its direct causes and effects or its Markov blanket, without learning the whole graph. And we want to use sparsity to scale causal discovery to millions of variables.

Try Andrey#

uv add andrey-core

Then run PC on a real dataset:

example.py#
import andrey
from andrey.data import load_dataset

df = load_dataset("sachs").data
out = andrey.pc(df)
print(out)
example.py#
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

Help us build it#

Andrey 0.1.0 is in alpha, the API may change between releases.

When you try it on your own data, tell us what breaks or which method you need. We’d welcome a pull request too. The contributing guide explains how to set up.


AI statement. Parts of this post were drafted with Claude Code and Codex. The author checked every statement, number, and reference and is responsible for the content.