The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Bayesian Inference Reimagined for R, Python and Julia

A unified probabilistic programming library bridging the gap between user-friendly R syntax and high-performance JAX computation.
Run bespoke models on CPU, GPU, or TPU with ease.

License: GPL (>= 3) R build status


One Mental Model. Three Languages.

BayesianInference (BI) provides a unified experience across R, Python, and Julia. Whether you work in R’s formula syntax, Python’s object-oriented approach, or Julia’s mathematical elegance, the model logic remains consistent.

Compare the Syntax

R Syntax Python Syntax Julia Syntax
model <- function(height, weight){
  # Priors
  sigma = bi.dist.uniform(0, 50, name='sigma', shape=c(1))
  alpha = bi.dist.normal(178, 20, name='alpha', shape=c(1))
  beta  = bi.dist.normal(0, 1, name='beta', shape=c(1))

  # Likelihood
  mu = alpha + beta * weight
  bi.dist.normal(mu, sigma, obs=height)
}
def model(height, weight):
    # Priors
    sigma = bi.dist.uniform(0, 50, name='sigma', shape=(1,))
    alpha = bi.dist.normal(178, 20, name='alpha', shape=(1,))
    beta  = bi.dist.normal(0, 1, name='beta', shape=(1,))

    # Likelihood
    mu = alpha + beta * weight
    bi.dist.normal(mu, sigma, obs=height)
@BI function model(weight, height)
    # Priors
    sigma = bi.dist.uniform(0, 50, name='sigma', shape=(1,))
    alpha = bi.dist.normal(178, 20, name='alpha', shape=(1,))
    beta  = bi.dist.normal(0, 1, name='beta', shape=(1,))

    # Likelihood
    mu = alpha + beta * weight
    bi.dist.normal(mu, sigma, obs=height)
end

Built for Speed

Leveraging Just-In-Time (JIT) compilation, BI outperforms traditional engines on standard hardware and unlocks massive scalability on GPU clusters for large datasets.

Benchmark: Network Size 100 (Lower is Better)

Engine Execution Time Relative Performance
STAN (CPU) ████████████████████████████ Baseline
BI (CPU) ████████████ ~2.5x Faster

> Comparison of execution time for a Social Relations Model. Source: Sosa et al. (2025).


Installation & Setup

1. Install Package

Use devtools to pull the latest development version from GitHub.

if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools")
devtools::install_github("https://github.com/BGN-for-ASNA/BIR")

2. Initialize Environment

Run the starting test to create the Python virtual environment managed by reticulate.

library(BayesianInference)
# Run the starting test to install Python dependencies
BI_starting_test()

3. Select Backend

Choose 'cpu', 'gpu', or 'tpu' when importing the library.

# Initialize on CPU (default) or GPU/TPU
m <- importBI(platform = 'cpu')

Features

Data Manipulation

Modeling (via NumPyro)

Diagnostics (via ArviZ)


Available Distributions

The package provides wrappers for a comprehensive set of distributions from NumPyro.

Continuous

Discrete

Multivariate

Time Series & Stochastic Processes

Mixtures & Truncated

(See package documentation for the full list)


Documentation

For full documentation of functions and parameters, you can use the built-in R help or the package helper:

# Open package documentation
bi.doc()

# Help for a specific function
?bi.dist.normal

Platform Support

GPU support available on compatible systems with JAX GPU installation.



BayesianInference (BIR)
Based on “The Bayesian Inference library for Python, R and Julia” by Sosa, McElreath, & Ross (2025).

Documentation | GitHub | Issues

© 2025 BayesianInference Team. Released under GPL-3.0.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.