Skip to main content

Tree traversals using JAX

Project description

Hyperiax

Hyperiax logo

Hyperiax is a pure-JAX library for message passing on rooted trees. It provides immutable tree data structures, typed per-node arrays, and decorator-based sweeps that compose with jax.jit, jax.vmap, and jax.lax.scan.

Hyperiax is designed for phylogenetic and tree-structured scientific computing, including Gaussian graphical models, phylogenetic means, and guided inference for diffusion processes on trees.

Installation

Hyperiax requires Python 3.11 or newer.

pip install hyperiax

The core package depends only on JAX, jaxlib, and NumPy. For accelerator-backed JAX installations, follow the official JAX installation instructions for your platform before or after installing Hyperiax.

Quick Start

import jax.numpy as jnp
import hyperiax as hx

topology = hx.symmetric_topology(depth=2, degree=2)
tree = hx.Tree.empty(topology, {"value": (2,)})

leaf_count = int(topology.is_leaf.sum())
tree = tree.at[topology.is_leaf].set(value=jnp.ones((leaf_count, 2)))


@hx.up(reads_children=("value",), writes=("value",))
def average_children(node, children, params):
    return {"value": children.value.mean(0)}


result = average_children(tree)
root_value = result.value[0]

Sweeps are ordinary Tree -> Tree functions. The @hx.up and @hx.down decorators declare which fields are read and written, so dispatch remains explicit and JAX-friendly.

Architecture

hyperiax/
├── core/      # Topology, Tree, Schema, views, sweep dispatch, builders
├── utils/     # Pure-JAX ODE and SDE solvers
└── prebuilt/  # Ready-to-use sweeps for BFFG and phylogenetic means

Core

hyperiax.core contains the public primitives:

  • Topology for rooted tree structure.
  • Tree for immutable per-node JAX arrays.
  • Schema for field shape and dtype validation.
  • @hx.up and @hx.down for message-passing sweeps.
  • Newick helpers for importing and exporting rooted trees.

Utilities

hyperiax.utils contains pure-JAX numerical helpers, including ODE and SDE solvers used by the prebuilt guided-inference routines.

Prebuilt Sweeps

hyperiax.prebuilt contains focused implementations for common tree workflows:

  • phylo_mean for weighted phylogenetic means.
  • bffg for Backward Filtering Forward Guiding on discrete Gaussian and continuous SDE edges.

Documentation

Tutorials and API reference are available in the project documentation:

  • Quickstart and sweep-writing tutorials under docs/source/notebooks/.
  • Public API reference under docs/source/api/.

Reference

The BFFG implementation follows:

van der Meulen, F. H. & Sommer, S. (2025). Backward Filtering Forward Guiding. JMLR 26(281), 1-51. https://arxiv.org/abs/2505.18239

Contact

Hyperiax is maintained by CCEM, University of Copenhagen. For technical questions, please open a GitHub issue or contact Stefan Sommer.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hyperiax-3.0.0.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hyperiax-3.0.0-py3-none-any.whl (45.6 kB view details)

Uploaded Python 3

File details

Details for the file hyperiax-3.0.0.tar.gz.

File metadata

  • Download URL: hyperiax-3.0.0.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hyperiax-3.0.0.tar.gz
Algorithm Hash digest
SHA256 d8d7d540c9be87c9cff4218d1274e54a4034e63268a2f6e16fc96bad2d9bfcf2
MD5 822318e4c78fedee85ef3989a3e3cc8e
BLAKE2b-256 744f6d235e358601128aa23892d4ca1240b62a5ff4afa0dd33ab0551c27aa4f2

See more details on using hashes here.

File details

Details for the file hyperiax-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: hyperiax-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 45.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hyperiax-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81531a2c24fdf25500c1059df7217612352f5d4f8224267b1b9f9513fb36d34f
MD5 a0f6de0c1a24a4bef5ff79e9ae2a5179
BLAKE2b-256 f2e512cb6df0e4e9fc90fb5e20d645c83e29f087834b098bdeb057280b8d7af3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page