--- name: faq description: Frequently asked questions about Andrey - what data it learns from, its methods, speed and scale, the command line, and the project. meta: type: guide tags: [faq] --- # FAQ ## Getting started ### What is Andrey? An open-source Python package that learns causal graphs from data. Its {{ method_count }}, of which {{ n_supported }} 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](#does-it-handle-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. ```shell uv add andrey-core ``` ```shell pip install andrey-core ``` [Getting started](guides/getting-started.md#install) 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](ci.md)). 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](configuration.md#parallel-search) lists the variables. ### What is the quickest way to try it? Run the [quickstart](guides/getting-started.md#learn-a-graph), try a [demo](examples/index.md#interactive-demos) in your browser, or open one of the [example notebooks](examples/index) in Colab. Each notebook installs Andrey in its first cell. ## Methods ### Which methods are there? {{ n_supported }} are supported: {{ supported_methods }}. The [API reference](api.md#structure-learning-methods) 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](benchmarks.md) 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](benchmarks.md) 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](https://andrey.abel.ai/#compare) 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](../blog/20261008-why-andrey-is-fast.md) 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](configuration.md#gpu-dispatch) 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](benchmarks.md) 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](benchmarks/0.1.0.md#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](configuration.md#parallel-search) 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](guides/getting-started.md#backends-and-parallelism) 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`. {{ indep_test_methods }} test independence on categorical data with `indep_test="chisq"` or `"gsq"`, and {{ score_func_methods }} 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](benchmarks.md) 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](guides/getting-started.md#data-types) explains the settings. The LiNGAM methods assume continuous non-Gaussian noise. ### Does it handle missing values? Yes, in {{ missing_methods }}. 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](benchmarks.md) measure it against dropping incomplete samples. The searches whose fit reads the data only through their covariance, {{ em_methods }}, 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](https://github.com/Abel-ai-lab/Andrey/blob/main/benchmarks/comparisons/missing-data.md) has what we measured. The other methods refuse missing values with an error that says what to do instead, and [Missing values](guides/getting-started.md#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 {{ no_knowledge_methods }}. 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](guides/getting-started.md#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 ` 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](benchmarks.md) 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 {{ targets_names }} 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? ```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](api.md#command-line-interface) 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 --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: ```text 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](changelog.md) and the [upgrade guide](guides/upgrading.md) before upgrading. The public API is what the [API reference](api.md) documents; names that start with an underscore are private and can change in any release. ### What is planned next? The [roadmap](roadmap.md) lists the planned work in order, starting with the major methods of each family. The [roadmap issue](https://github.com/Abel-ai-lab/Andrey/issues/1) on GitHub tracks the progress of each stage. ### What is the license? The Apache License 2.0. ### Who builds it? [Abel AI Lab](https://abel.ai/). ### 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](https://github.com/Abel-ai-lab/Andrey/issues/new). ### How do I cite it? Cite the software with this BibTeX entry; the repository's [`CITATION.cff`](https://github.com/Abel-ai-lab/Andrey/blob/main/CITATION.cff) has the same citation. ```bibtex @software{andrey, author = {{Abel AI Lab}}, title = {Andrey: Accelerated, accurate, agentic causal discovery}, year = {2026}, version = {0.18.0}, url = {https://andrey.abel.ai}, } ```