Beta version of 'Bayesian Inference' (BI) using 'python' and BI. It aims to unify the modeling experience by providing an intuitive model-building syntax together with the flexibility of low-level abstraction coding. It also includes pre-built functions for high-level abstraction and supports hardware-accelerated computation for improved scalability, including parallelization, vectorization, and execution on CPU, GPU, or TPU.
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.
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.
| R Syntax | Python Syntax | Julia Syntax |
|---|---|---|
|
|
|
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).
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")
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()
Choose 'cpu', 'gpu', or 'tpu' when importing the library.
# Initialize on CPU (default) or GPU/TPU
m <- importBI(platform = 'cpu')
The package provides wrappers for a comprehensive set of distributions from NumPyro.
bi.dist.normal, bi.dist.uniform, bi.dist.student_tbi.dist.cauchy, bi.dist.halfcauchy, bi.dist.halfnormalbi.dist.gamma, bi.dist.inverse_gamma, bi.dist.exponentialbi.dist.beta, bi.dist.beta_proportionbi.dist.laplace, bi.dist.asymmetric_laplacebi.dist.log_normal, bi.dist.log_uniformbi.dist.pareto, bi.dist.weibull, bi.dist.gumbelbi.dist.chi2, bi.dist.gompertzbi.dist.bernoulli, bi.dist.binomialbi.dist.poisson, bi.dist.negative_binomialbi.dist.geometric, bi.dist.discrete_uniformbi.dist.beta_binomial, bi.dist.zero_inflated_poissonbi.dist.multivariate_normal, bi.dist.multivariate_student_tbi.dist.dirichlet, bi.dist.dirichlet_multinomialbi.dist.multinomialbi.dist.lkj, bi.dist.lkj_choleskybi.dist.wishart, bi.dist.wishart_choleskybi.dist.gaussian_random_walkbi.dist.gaussian_state_spacebi.dist.euler_maruyamabi.dist.car (Conditional AutoRegressive)bi.dist.mixture, bi.dist.mixture_same_familybi.dist.truncated_normal, bi.dist.truncated_cauchybi.dist.lower_truncated_power_law(See package documentation for the full list)
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
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.