FAQ#
Getting started#
What is Andrey?#
An open-source Python package that learns causal graphs from data. Its 55 methods, of
which 50 are supported and benchmarked and the rest experimental, cover continuous,
categorical, and mixed data; independent samples and time series; linear and nonlinear
relationships; data with hidden common causes; and data from interventions or several domains.
Most take background knowledge: edges that must or cannot exist, and the order of tiers in time.
Most methods that test conditional independence accept
missing values, and andrey.bootstrap gives each edge’s
frequency over refits on resampled data. The methods include PC, FCI, GFCI, GES, XGES, BOSS,
GRaSP, the LiNGAM family, PCMCI, and LPCMCI. Many methods spread their work over CPU cores, and
some run on a GPU. A command line that answers in JSON and an agent skill make it usable by AI
agents.
How do I install it?#
The package on PyPI is andrey-core, and it imports as andrey. It needs Python 3.11 or later;
CI tests 3.11 to 3.14.
uv add andrey-core
pip install andrey-core
Getting started covers the optional extras, installing from GitHub, and building from source.
Which operating systems does it support?#
Linux |
macOS |
Windows |
|
|---|---|---|---|
Installs and runs on the CPU |
✓ |
✓ |
✓ |
Full test suite |
✓ |
✗ |
✗ |
GPU speedups (CUDA) |
✓ |
✗ |
✗ |
Linux is supported; macOS and Windows install and run on the CPU, with no guarantee yet (Testing). On demand, CI checks the install, the command line, and small fits on macOS and Windows on the CPU, and the unit tests on macOS; the rest of the test suite there is planned.
The defaults of the speed cutoffs, such as how large a pass must be to use the worker processes, are
measured on Linux servers. On another machine, run andrey calibrate once and set the values it
prints; Configuration lists the variables.
What is the quickest way to try it?#
Run the quickstart, try a demo in your browser, or open one of the example notebooks in Colab. Each notebook installs Andrey in its first cell.
Methods#
Which methods are there?#
50 are supported: pc, fci, gfci, cdnod, fci_jci, icp, iamb, inter_iamb, mmpc, ges, gies, gnies, xges, ages, hc, tabu, exact_search, calm, notears, dagma, mmhc, rsmax2, boss, grasp, boss_fci, grasp_fci, igsp, ut_igsp, direct_lingam, ica_lingam, multi_group_direct_lingam, cam, resit, score_matching, nogam, varma_lingam, longitudinal_lingam, pcmci, pcmciplus, jpcmciplus, lpcmci, granger, dynotears, anm, pnl, loci, gin, rcd, bottom_up_parce_lingam, and camuv. The
API reference lists them all, and andrey list prints
them with their status.
What is the difference between supported and experimental?#
A supported method is benchmarked and checked on known graphs before each release. An experimental
method has recovery tests but is not supported: it has no published benchmark yet, or it did not
pass one, and its Limitations say which. It warns with andrey.ExperimentalWarning the first
time it runs in a process. A new method starts as experimental.
Which method should I start with?#
For continuous data with no hidden variables, start with pc or ges; both return a CPDAG. Use
fci when hidden variables may confound the data; it returns a PAG. Use direct_lingam when the
relationships are linear and the noise is not Gaussian; it returns a DAG with edge weights.
Does it have neural methods?#
No. We focus on speeding up statistical causal discovery methods, the ones built on independence tests and scores.
Why does a result differ from another package’s?#
Methods can break ties in a different order, use different defaults, or treat the column order differently. The release cards score every package on the same true graphs, so compare accuracy there rather than edge by edge.
Speed and hardware#
Is it the fastest causal discovery package?#
Andrey is built to be: it batches its work into array operations, runs on every CPU core, and runs on a GPU, though support varies by method and configuration. You can use the release cards to compare Andrey with causal-learn, lingam, and other packages on the same data and machines: fit time, error counts, and where Andrey is not faster. The homepage compares their interfaces, method families, and speed support.
It is not the fastest on every method. On discrete data, bnlearn is faster than Andrey for IAMB, Inter-IAMB, MMPC, MMHC, and RSMAX2 with the chi-square and G-square tests, in most settings of the 0.13.0 release card. Each of these tests counts a new table over every row: bnlearn does that in compiled C, and Andrey does it with NumPy, which costs more per test. We keep Andrey pure Python, so it installs anywhere without a compiler, and the cards report these cases with the rest.
Why is it faster?#
It batches independent tests and scores into array operations, reuses work across steps, skips work that cannot change the result, and uses GPU code where that helps. Why Andrey is fast explains the four ideas.
Do I need a GPU?#
No. The default install uses NumPy on the CPU. The torch extra adds a PyTorch backend, which
CALM needs. A CUDA GPU speeds up covariance and correlation, the entropy terms of DirectLiNGAM and
the methods built on it, the KCI and CMIknn tests, and the tests of PNL;
Configuration says when each moves. Apple GPUs are not supported
in the alpha.
What do the optional extras add?#
torch: the PyTorch backend for GPUs, and CALM.viz: Matplotlib chart styling (andrey.viz.mpl), and Graphviz layouts for drawn graphs.all: both.
How large a problem can it handle?#
It depends on the method, the data, and the machine, so the release cards time each method at growing sizes against the packages that implement it. A few published examples: PC learns a 400-variable graph in under a second, where causal-learn takes ten minutes; tabu search fits 800 variables and 8,000 rows in under two seconds, where bnlearn takes sixteen minutes; BOSS and FCI finish 800 variables; and PCMCI fits 160 time series in five seconds, where tigramite takes eight minutes. Finishing is not the same as being accurate: the 0.1.0 release card’s large graphs section lists where a method’s errors reach the empty graph’s.
Can it use more CPU cores?#
GES, GFCI, the skeleton search of PC and the methods built on it, and the possible-d-separation
step of FCI, FCI-JCI, and GFCI can spread their larger passes over worker processes: set
ANDREY_N_JOBS above 1. They return the same graph as with one worker;
Configuration lists the methods and tests that use them. A
script that does this must put its entry point under if __name__ == "__main__":, because
starting the workers re-imports the script;
Getting started shows how. A pass or search
uses the workers only above a work cutoff. The defaults suit one fit per process; for a process
that runs many fits, andrey calibrate measures the cutoffs on your machine and prints the
settings.
Data#
What input does it take?#
A NumPy array or a pandas DataFrame, with samples in rows and variables in columns. A DataFrame’s
column names become the graph’s node labels. From the command line, a CSV or TSV file (its header
row names the nodes) or a .npy file.
Does it handle discrete or mixed data?#
Discrete data, yes: code each category as a whole number, or pass a DataFrame whose columns hold
text, booleans, or a pandas category. PC, FCI, GFCI, CD-NOD, FCI-JCI, IAMB, Inter-IAMB, MMPC, MMHC, RSMAX2, BOSS-FCI, GRaSP-FCI, IGSP, UT-IGSP, SkewD-MV, PCMCI, PCMCI+, J-PCMCI+, and LPCMCI test independence on categorical
data with indep_test="chisq" or "gsq", and GFCI, GES, GIES, XGES, hill climbing, tabu search, exact search, MMHC, RSMAX2, BOSS, GRaSP, BOSS-FCI, and GRaSP-FCI score it with
score_func="bdeu" or "discrete_bic". For mixed data, with continuous and categorical columns,
the same methods take indep_test="degen_gauss" or "cond_gauss" and score_func="degen_gauss" or
"cond_gauss". By default they pick the test and the score from the column types you declare, with
categorical or a DataFrame’s category, bool, or text columns: gsq and bdeu when every
column is categorical, cond_gauss when some are. A column of a few whole numbers that you have not
declared reads as numbers, with a warning. The release cards benchmark PC, FCI,
IAMB, Inter-IAMB, MMPC, MMHC, RSMAX2, GES, hill climbing, BOSS, and GRaSP on categorical data, and
PC, GES, and hill climbing on mixed data, against causal-learn, Tetrad, bnlearn, pgmpy, or an
earlier Andrey release; the other methods are not benchmarked on those data yet.
Data types explains the settings. The LiNGAM methods assume
continuous non-Gaussian noise.
Does it handle missing values?#
Yes, in PC, FCI, CD-NOD, FCI-JCI, IAMB, Inter-IAMB, MMPC, PCMCI, PCMCI+, LPCMCI, ANM, PNL, LOCI, and SkewD. Mark a missing value with NaN or pandas’ NA, or leave its field
empty in a CSV file. Each conditional-independence test then reads only the samples where all of its
variables are observed (test-wise deletion), so the fit keeps the samples that dropping every
incomplete one would lose; missing="testwise" names this handling, the default, and PC also takes
missing="mvpc", a correction for values whose missingness depends on the variables.
Test-wise deletion is sound when values are missing completely at random; when whether a value is
missing depends on the variables, a test can be biased. The release cards measure
it against dropping incomplete samples. The searches whose fit reads the data only through their
covariance, GES, XGES, hill climbing, tabu search, exact search, CALM, NOTEARS, DAGMA, BOSS, and GRaSP, take missing="em": structural EM over the expected covariance of
the data, sound when values are missing completely at random or at random given observed values. It
is supported in GES, hill climbing, Tabu search, BOSS, GRaSP, and NOTEARS, where it runs Friedman’s
alternating scheme: 10 searches, with 5 parameter-only EM steps before each after the first. It is
experimental in the others, which have no reference implementation to compare with; the
missing-data comparison
has what we measured.
The other methods refuse missing values with an error that says what to do
instead, and Missing values explains each handling.
Can I tell it what I already know?#
Yes, with andrey.Knowledge: edges that must exist, edges that cannot, and tiers, where no edge
points from a later tier into an earlier one, such as nothing causing a person’s age. Every method
takes it except ICP, AGES, CPCM-graph, SkewD-MV, ANM, PNL, LOCI, CPCM, SkewD, and GIN. It can also say that one variable causes another,
directly or not (required_paths), that it does not (forbidden_paths), or that two variables
share a hidden common cause (confounded). PC, GES, BOSS, and most searches that return a CPDAG
honor the paths, the FCI family and LPCMCI honor all three, and DirectLiNGAM honors the paths. They
are supported in every method that honors them except six: required paths are experimental in Tabu
search, MMHC, and RSMAX2, and forbidden paths in IAMB, Inter-IAMB, and MMPC, where our measurements
did not pass; a method given a part it does not honor raises an error naming the methods that do. A
path claim says less than an edge, so when you know the edge itself, state it as required.
Background knowledge shows each part.
How sure is each edge?#
andrey.bootstrap(method, data) refits a method on 100 resamples of the data and counts how often
each edge appears. It returns each edge’s frequency, a table of the edges, and an averaged graph:
each pair takes the state it has most often, no edge included, and the result is made a valid
graph of the method’s kind; andrey bootstrap <method> does the same from the command line. Each
resample is half of the rows, drawn without replacement; resampling="bootstrap" draws all the
rows with replacement instead. Read the frequencies as a ranking: in the 0.11.0
release card’s simulations, which used that bootstrap resampling, edges seen in more than nine fits
in ten were almost always true. A frequency is not the probability that an edge is true: a method
that makes the same mistake on every resample gives it a frequency of 1.
Time series and several datasets?#
Yes. varma_lingam, longitudinal_lingam, pcmci, pcmciplus, jpcmciplus, lpcmci, granger,
and dynotears learn graphs over time lags; jpcmciplus reads several datasets with shared
contexts, lpcmci also allows hidden common causes, and dynotears fits a linear structural vector
autoregression by continuous optimization. The release cards benchmark them
against tigramite, lingam, causal-learn, and CausalNex. multi_group_direct_lingam fits several
datasets that share one causal order, cdnod takes data from several domains, and
icp, gies, gnies, igsp, and ut_igsp take data from several environments: gies and igsp with known
interventions, gnies learning the variables whose noise variance changed, ut_igsp learning the
targets it is not given, and icp the parents of one target. All are supported.
Command line and agents#
How do I run a method from the shell?#
andrey list # every method, with its status
andrey run pc --help # its inputs and parameters
andrey run pc --data your_data.csv alpha=0.01
The command-line reference has every command and flag.
How does an agent use it?#
The andrey command never prompts. andrey run and andrey list print JSON when a program
reads their output, and every command takes --json. andrey run <method> --help --json gives a
method’s parameters as JSON Schema without running it, and andrey --skill prints a skill that
teaches an agent all of this. To install it, paste this prompt into your coding agent:
Install Andrey's agent skill: make sure the andrey-core package is installed, run
`andrey --skill`, and save its output as andrey/SKILL.md in your skills folder.
The project#
How stable is it?#
Andrey is in alpha: any release may change the API, including the supported methods. Pin the version you depend on, and read the changelog and the upgrade guide before upgrading. The public API is what the API reference documents; names that start with an underscore are private and can change in any release.
What is planned next?#
The roadmap lists the planned work in order, starting with the major methods of each family. The roadmap issue on GitHub tracks the progress of each stage.
What is the license?#
The Apache License 2.0.
Who builds it?#
Where does the name “Andrey” come from?#
From two mathematicians named Andrey whose ideas causal discovery still runs on.
Andrey Markov (1856-1922) studied chains of events in which the next step depends only on the present one. Causal discovery borrows his idea: once you know a variable’s direct causes, nothing else except its own effects tells you more about it. That assumption, the Markov condition, is where PC, GES, and FCI start.
Andrey Kolmogorov (1903-1987) set down the axioms of probability we still use, and later measured how complex an object is by the length of the shortest program that produces it. Causal discovery uses that idea to tell cause from effect: a cause and the mechanism that turns it into its effect should carry no information about each other.
We named the package for both, and built it to make their ideas fast enough to use every day.
How do I report a bug or ask for a method?#
Open an issue on GitHub.
How do I cite it?#
Cite the software with this BibTeX entry; the repository’s
CITATION.cff has the same
citation.
@software{andrey,
author = {{Abel AI Lab}},
title = {Andrey: Accelerated, accurate, agentic causal discovery},
year = {2026},
version = {0.18.0},
url = {https://andrey.abel.ai},
}