A JAX-native library of probability distributions and bijectors, reimplementing a subset of TensorFlow Probability with emphasis on readability and extensibility.
Distrax is a lightweight probability library built for JAX that provides implementations of probability distributions and bijectors. It reimplements a subset of TensorFlow Probability with a focus on JAX-native performance, readability, and extensibility, solving the need for efficient probabilistic computation within the JAX ecosystem.
Researchers and developers working with probabilistic models in JAX, especially those needing custom distributions, bijectors, or compatibility with TensorFlow Probability in JAX-based projects.
Developers choose Distrax for its JAX-native design, which ensures seamless integration with JAX transformations, its emphasis on code readability and extensibility for custom probabilistic components, and its cross-compatibility with TensorFlow Probability for flexible workflows.
Distrax is a lightweight probability library built for JAX, offering distributions and bijectors as a reimplementation of core TensorFlow Probability functionality. It provides a JAX-native alternative that emphasizes readability, extensibility, and cross-compatibility with TFP, making it ideal for probabilistic modeling in JAX-based research and applications.
jit, vmap, and grad.sample_and_log_prob and forward_and_log_det provide optimized one-line sampling with log-probabilities.Distrax prioritizes readability and extensibility while maintaining compatibility with TensorFlow Probability, aiming to be a practical, JAX-friendly tool for probabilistic computation without replicating TFP's full feature set.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Distrax is built from the ground up for JAX, enabling seamless use of transformations like jit, vmap, and grad, as demonstrated in examples where distributions are passed as arguments to jitted functions.
Simple subclassing interfaces for Distribution and Bijector allow easy definition of custom components, highlighted as useful for reinforcement learning policies and novel probabilistic models.
Distrax distributions and bijectors can interoperate with TensorFlow Probability equivalents, enabling mixed workflows and easy migration, as shown in examples with kl_divergence and meta-distributions.
Methods like sample_and_log_prob and forward_and_log_det provide optimized one-line calls for sampling and transformations, improving performance in JAX-based computations.
As a lightweight reimplementation of TFP, Distrax intentionally lacks many advanced features, such as comprehensive Bayesian inference tools or complex hierarchical models, limiting its scope.
The README explicitly warns that support for jax.vmap and jax.pmap is experimental and incomplete, causing potential exceptions with complex objects like MultivariateNormalDiag.
Unlike TFP's dynamic event_ndims, Distrax requires using Block to handle different event dimensions statically, adding complexity and manual steps for some transformations.