Metadata-Version: 2.5
Name: andrey-core
Version: 0.20.0
Summary: Andrey: accelerated, accurate, agentic causal discovery. Install andrey-core, import andrey.
Project-URL: Homepage, https://andrey.abel.ai
Project-URL: Documentation, https://andrey.abel.ai/docs/
Project-URL: Source, https://github.com/Abel-ai-lab/Andrey
Project-URL: Issues, https://github.com/Abel-ai-lab/Andrey/issues
Project-URL: Changelog, https://andrey.abel.ai/docs/changelog.html
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: bayesian networks,boss,causal discovery,causal graph,causal inference,fci,ges,gpu,lingam,mixed data,pc algorithm,pcmci,structure learning,time series
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.11
Requires-Dist: networkx>=3.3
Requires-Dist: numpy>=2.0
Requires-Dist: pandas>=2.2.2
Requires-Dist: pydantic>=2
Requires-Dist: pyyaml>=6
Requires-Dist: scikit-learn>=1.9
Requires-Dist: scipy>=1.14
Requires-Dist: statsmodels>=0.14.2
Requires-Dist: threadpoolctl>=3.5
Requires-Dist: typer>=0.26.0
Provides-Extra: all
Requires-Dist: matplotlib>=3.8.4; extra == 'all'
Requires-Dist: pygraphviz>=2; extra == 'all'
Requires-Dist: torch>=2.5; extra == 'all'
Provides-Extra: torch
Requires-Dist: torch>=2.5; extra == 'torch'
Provides-Extra: viz
Requires-Dist: matplotlib>=3.8.4; extra == 'viz'
Requires-Dist: pygraphviz>=2; extra == 'viz'
Description-Content-Type: text/markdown

<!-- One image on its own dark ground reads on both GitHub themes; PyPI keeps a plain <img>. The
banner links the website's homepage. -->
<p align="center">
  <a href="https://andrey.abel.ai/"><img alt="Andrey: accelerated, accurate, agentic causal discovery"
    src="https://raw.githubusercontent.com/Abel-ai-lab/Andrey/v0.20.0/.github/readme/banner.svg" width="830"></a>
</p>

<p align="center">
  <a href="https://pypi.org/project/andrey-core/"><img alt="PyPI version"
    src="https://img.shields.io/pypi/v/andrey-core?label=PyPI&amp;color=3b5bdb"></a>
  <a href="https://pepy.tech/projects/andrey-core"><img alt="PyPI downloads"
    src="https://img.shields.io/pepy/dt/andrey-core?label=downloads&amp;color=3b5bdb"></a>
  <a href="https://github.com/Abel-ai-lab/Andrey/actions/workflows/ci.yml"><img alt="CI status"
    src="https://img.shields.io/github/actions/workflow/status/Abel-ai-lab/Andrey/ci.yml?branch=main&amp;label=CI"></a>
  <img alt="Python 3.11, 3.12, 3.13, 3.14"
    src="https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-3b5bdb">
  <a href="https://github.com/Abel-ai-lab/Andrey/blob/main/LICENSE"><img alt="License: Apache 2.0"
    src="https://img.shields.io/badge/license-Apache%202.0-3b5bdb"></a>
</p>

---

## ⭐ What's new in 0.20.0

0.20.0 is an optimization release. Its speed work makes most fits faster without changing their
answer on the CPU, and several searches hold less memory. LGES, Regime-PCMCI, and the wGCM and PCM
tests are supported, and the GCM test stays experimental. `missing="em"` is supported in every
method that takes it, PC and FCI orient colliders by majority vote, RSMAX2 restricts with IAMB and
maximizes with tabu search, and FGES arrives, experimental.

**[0.20.0 release card](https://andrey.abel.ai/docs/benchmarks/0.20.0.html)**

---

Andrey is a causal discovery package for Python.

<!-- PITCH:START -->
<!-- Generated by apps/build_launch.py; do not edit. -->

- **Fast**: The fastest causal discovery package.
- **Accurate**: more than 80% fewer errors than other popular packages.
- **One API**: 57 supported methods, each one function call.
- **Any data**: continuous, categorical, mixed, time series, nonlinear, hidden confounders.
- **Agent-ready**: a command line that answers in JSON, and a skill for coding agents.

<!-- PITCH:END -->

```shell
uv add andrey-core
```

```shell
pip install andrey-core
```

You install andrey-core and then `import andrey`.

- **Optional extras**: `andrey-core[torch]` for GPUs and CALM, `andrey-core[viz]` for charts and
  graph layouts
- **From GitHub**, the latest release:
  `uv add "andrey-core @ git+https://github.com/Abel-ai-lab/Andrey@main"`
- **[Installation guide](https://andrey.abel.ai/docs/guides/getting-started.html#install)**: the
  extras, a PyTorch build for your GPU, and building Andrey from source

<!-- CARD:START -->
<!-- Generated from andrey.spec by apps/build_launch.py; do not edit. -->

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)"
      srcset="https://raw.githubusercontent.com/Abel-ai-lab/Andrey/v0.20.0/.github/readme/package-card-dark.svg">
    <img alt="Andrey: accelerated, accurate, agentic. 57 supported methods. Data types: continuous,
      categorical, mixed, time series, nonlinear. Real data processing: missing values,
      background knowledge, edge confidence. Graphs: DAG, CPDAG, PAG, temporal; hidden
      confounders. Acceleration: parallel CPU; GPU with PyTorch (CUDA). Portability: NetworkX,
      pcalg, Graphviz DOT, NumPy. Interface: Python, CLI, skill."
      src="https://raw.githubusercontent.com/Abel-ai-lab/Andrey/v0.20.0/.github/readme/package-card-light.svg" width="100%">
  </picture>
</p>

<p align="center"><a href="https://andrey.abel.ai/docs/benchmarks.html">Release cards</a></p>

<!-- CARD:END -->

## What's inside

<!-- METHODS:START -->
<!-- Generated from andrey.spec by apps/build_launch.py; do not edit. -->

| Family | Methods | Returns |
|---|---|---|
| Constraint-based | [`pc`](https://andrey.abel.ai/docs/api/andrey.pc.html), [`fci`](https://andrey.abel.ai/docs/api/andrey.fci.html), [`gfci`](https://andrey.abel.ai/docs/api/andrey.gfci.html), [`cdnod`](https://andrey.abel.ai/docs/api/andrey.cdnod.html), [`fci_jci`](https://andrey.abel.ai/docs/api/andrey.fci_jci.html), [`icp`](https://andrey.abel.ai/docs/api/andrey.icp.html), [`iamb`](https://andrey.abel.ai/docs/api/andrey.iamb.html), [`inter_iamb`](https://andrey.abel.ai/docs/api/andrey.inter_iamb.html), [`mmpc`](https://andrey.abel.ai/docs/api/andrey.mmpc.html) | CPDAG, PAG, DAG, Undirected graph |
| Score-based | [`ges`](https://andrey.abel.ai/docs/api/andrey.ges.html), [`fges`](https://andrey.abel.ai/docs/api/andrey.fges.html)\*, [`gies`](https://andrey.abel.ai/docs/api/andrey.gies.html), [`gnies`](https://andrey.abel.ai/docs/api/andrey.gnies.html), [`xges`](https://andrey.abel.ai/docs/api/andrey.xges.html), [`lges`](https://andrey.abel.ai/docs/api/andrey.lges.html), [`ages`](https://andrey.abel.ai/docs/api/andrey.ages.html), [`hc`](https://andrey.abel.ai/docs/api/andrey.hc.html), [`tabu`](https://andrey.abel.ai/docs/api/andrey.tabu.html), [`exact_search`](https://andrey.abel.ai/docs/api/andrey.exact_search.html), [`calm`](https://andrey.abel.ai/docs/api/andrey.calm.html), [`notears`](https://andrey.abel.ai/docs/api/andrey.notears.html), [`dagma`](https://andrey.abel.ai/docs/api/andrey.dagma.html), [`mmhc`](https://andrey.abel.ai/docs/api/andrey.mmhc.html), [`rsmax2`](https://andrey.abel.ai/docs/api/andrey.rsmax2.html) | CPDAG, DAG |
| Permutation-based | [`boss`](https://andrey.abel.ai/docs/api/andrey.boss.html), [`grasp`](https://andrey.abel.ai/docs/api/andrey.grasp.html), [`boss_fci`](https://andrey.abel.ai/docs/api/andrey.boss_fci.html), [`grasp_fci`](https://andrey.abel.ai/docs/api/andrey.grasp_fci.html), [`igsp`](https://andrey.abel.ai/docs/api/andrey.igsp.html), [`ut_igsp`](https://andrey.abel.ai/docs/api/andrey.ut_igsp.html) | CPDAG, PAG |
| Functional causal models | [`direct_lingam`](https://andrey.abel.ai/docs/api/andrey.direct_lingam.html), [`ica_lingam`](https://andrey.abel.ai/docs/api/andrey.ica_lingam.html), [`multi_group_direct_lingam`](https://andrey.abel.ai/docs/api/andrey.multi_group_direct_lingam.html), [`cam`](https://andrey.abel.ai/docs/api/andrey.cam.html), [`resit`](https://andrey.abel.ai/docs/api/andrey.resit.html), [`cpcm_graph`](https://andrey.abel.ai/docs/api/andrey.cpcm_graph.html), [`skewd_mv`](https://andrey.abel.ai/docs/api/andrey.skewd_mv.html), [`score_matching`](https://andrey.abel.ai/docs/api/andrey.score_matching.html), [`nogam`](https://andrey.abel.ai/docs/api/andrey.nogam.html), [`das`](https://andrey.abel.ai/docs/api/andrey.das.html) | DAG |
| Temporal causal discovery | [`varma_lingam`](https://andrey.abel.ai/docs/api/andrey.varma_lingam.html), [`longitudinal_lingam`](https://andrey.abel.ai/docs/api/andrey.longitudinal_lingam.html), [`pcmci`](https://andrey.abel.ai/docs/api/andrey.pcmci.html), [`pcmciplus`](https://andrey.abel.ai/docs/api/andrey.pcmciplus.html), [`jpcmciplus`](https://andrey.abel.ai/docs/api/andrey.jpcmciplus.html), [`rpcmci`](https://andrey.abel.ai/docs/api/andrey.rpcmci.html), [`lpcmci`](https://andrey.abel.ai/docs/api/andrey.lpcmci.html), [`granger`](https://andrey.abel.ai/docs/api/andrey.granger.html), [`dynotears`](https://andrey.abel.ai/docs/api/andrey.dynotears.html) | Temporal graph |
| Latent variables | [`gin`](https://andrey.abel.ai/docs/api/andrey.gin.html), [`rcd`](https://andrey.abel.ai/docs/api/andrey.rcd.html), [`bottom_up_parce_lingam`](https://andrey.abel.ai/docs/api/andrey.bottom_up_parce_lingam.html), [`camuv`](https://andrey.abel.ai/docs/api/andrey.camuv.html) | DAG, PAG |
| Pairwise direction | [`anm`](https://andrey.abel.ai/docs/api/andrey.anm.html), [`pnl`](https://andrey.abel.ai/docs/api/andrey.pnl.html), [`loci`](https://andrey.abel.ai/docs/api/andrey.loci.html), [`cpcm`](https://andrey.abel.ai/docs/api/andrey.cpcm.html), [`skewd`](https://andrey.abel.ai/docs/api/andrey.skewd.html) | Two-node DAG |

\* [Experimental](https://andrey.abel.ai/docs/api.html#experimental-methods):
not supported yet (see its Limitations), and the API may change.

<!-- METHODS:END -->

## Quick start

<!-- QUICKSTART:START -->
<!-- Generated by apps/build_launch.py, which runs the code; do not edit. -->

Learn the protein-signaling network of Sachs et al. (2005) from 853 cells, and score it against the
known network:

```python
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")})
```

```text
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

  indep_test: fisherz
  tie_break: rank
{'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 where the known network's CPDAG leaves them undirected), and 17 for a graph with no
edges.

<!-- QUICKSTART:END -->

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:

```shell
andrey run pc --data your_data.csv   # JSON when piped, a summary in a terminal
```

To give your coding agent Andrey's skill, paste this prompt into it:

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

## Learn more

- [Documentation](https://andrey.abel.ai/docs/): guides and the API reference.
- [Examples](https://andrey.abel.ai/docs/examples/): notebooks, one method or task each, and demos
  that run in your browser.
- [Release cards](https://andrey.abel.ai/docs/benchmarks.html): benchmark details for each
  release.
- [Why Andrey is fast](https://andrey.abel.ai/blog/20261008-why-andrey-is-fast.html)
- [FAQ](https://andrey.abel.ai/docs/faq.html) and
  [changelog](https://andrey.abel.ai/docs/changelog.html).
- [Roadmap](https://andrey.abel.ai/docs/roadmap.html): the planned work, stage by stage.

Andrey is in alpha: the API may change between releases, so pin the version you use. Linux is
supported; macOS and Windows install and run on the CPU, with no guarantee yet
([Testing](https://andrey.abel.ai/docs/ci.html)). Apple GPUs are not supported in the alpha.

## Citing, license, contributing

If you use Andrey in your work, please cite it, or use the
[citation file](https://github.com/Abel-ai-lab/Andrey/blob/main/CITATION.cff):

```bibtex
@software{andrey,
  author = {{Abel AI Lab}},
  title = {Andrey: Accelerated, accurate, agentic causal discovery},
  year = {2026},
  version = {0.20.0},
  url = {https://andrey.abel.ai},
}
```

Andrey is released under the
[Apache License 2.0](https://github.com/Abel-ai-lab/Andrey/blob/main/LICENSE). Bug reports and pull
requests are welcome in the [issue tracker](https://github.com/Abel-ai-lab/Andrey/issues); the
[contributing guide](https://github.com/Abel-ai-lab/Andrey/blob/main/CONTRIBUTING.md) explains how
to set up a development environment.

We write much of Andrey with AI coding tools, under our maintainers' direction and review, and you
are welcome to use them in a contribution. However a change is written, it follows the same rules,
passes the same checks, and goes through a pull request that a person answers for. Benchmark
numbers come from recorded runs and are never written by an AI tool, and each blog post and release
card ends with a statement of how AI tools were used to write it. The
[AI policy](https://github.com/Abel-ai-lab/Andrey/blob/main/DEVELOPMENT.md#ai-tools) has the rules.

Andrey is inspired by
[causal-learn](https://github.com/py-why/causal-learn), [pgmpy](https://github.com/pgmpy/pgmpy),
[Tetrad](https://github.com/cmu-phil/tetrad), and many other causal discovery packages.
