- Notifications
You must be signed in to change notification settings - Fork12
BridgeStan provides efficient in-memory access through Python, Julia, and R to the methods of a Stan model.
License
BSD-3-Clause, CC-BY-4.0 licenses found
Licenses found
roualdes/bridgestan
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation

BridgeStan provides efficient in-memory access through Python, Julia,Rust, and R to the methods of aStan model, includinglog densities, gradients, Hessians, and constraining and unconstrainingtransforms. The motivation was developing inference algorithms inhigher-level languages for arbitrary Stan models.
Stan is a probabilistic programming language for coding statisticalmodels. For an introduction to what can be coded in Stan, see theStan User's Guide.
BridgeStan is currently shipping with Stan version 2.37.0
Documentation is available athttps://roualdes.us/bridgestan/
BridgeStan has been tested with the following operating system and C++compiler combinations.
- Linux: Ubuntu 20.04 with gcc 9.4.0
- Apple: Mac OS X 12.2 with Apple clang 11.0.3
- Microsoft: Windows 10 with gcc MSYS2 5.3.0
Installing the core of BridgeStan is as simple asinstalling a C++ toolchain(libraries, compiler, and themake command), and downloading thisrepository. To download the latest development version, you can run
git clone --recurse-submodules https://github.com/roualdes/bridgestan.git
For a full guide on installing, configuring, and using BridgeStan, consult thedocumentation
To compile the Stan model intest_models/multi/multi.stan to a binaryshared object (.so file), use the following.
$ cd bridgestan$ make test_models/multi/multi_model.soThis will require internet access the first time you run it in orderto download the appropriate Stan compiler for your platform into<bridgestan-dir>/bin/stanc[.exe]
This repository includes examples of calling Stan through BridgeStanin Python, Julia, R, Rust, and C.
From Python:
example.pyFrom Julia:
example.jlFrom R:
example.rFrom Rust:
example.rsFrom C:
example.c
Examples of other functionality can be found in thetest folder for each interface.
We are aware of the following projects using BridgeStan.
- https://github.com/sethaxen/StanLogDensityProblems.jl
- https://github.com/Julia-Tempering/Pigeons.jl
- https://github.com/TuringLang/TuringBenchmarking.jl
- https://github.com/pymc-devs/nutpie (through Rust)
- https://github.com/UoL-SignalProcessingGroup/retrospectr
- https://github.com/UoL-SignalProcessingGroup/SMC-NUTS
- https://github.com/JTorgander/hmc-sandbox
- https://github.com/UCL/rmcmc
- https://github.com/CerulloE1996/BayesMVP/
If you use BridgeStan in your research, please consider citingour JOSS paperand letting us know so we can list your project here.
- Verified Density Compilation for a Probabilistic Programming Language
- Variational Inference with Gaussian Score Matching
- Stein Π-Importance Sampling
- Batch and match: black-box variational inference with a score-based divergence
- Variational Inference in Location-Scale Families: Exact Recovery of the Mean and Correlation Matrix
- Sampling From Multiscale Densities With Delayed Rejection Generalized Hamiltonian Monte Carlo
- MCBench: A Benchmark Suite for Monte Carlo Sampling Algorithms
The Julia and Python APIs were derived from theStan Model ServerAPI, which in turn was derived fromReddingStan.
Thanks to Sebastian Weber (GitHub@wds15)for enabling multi-threaded calls from Julia to a single Stan model instance.
Thanks to Adrian Seyboldt (GitHub@aseyboldt)for providing the Rust wrapper.
About
BridgeStan provides efficient in-memory access through Python, Julia, and R to the methods of a Stan model.
Topics
Resources
License
BSD-3-Clause, CC-BY-4.0 licenses found
Licenses found
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors12
Uh oh!
There was an error while loading.Please reload this page.