acerbilab / model fitting

Open-source tools for fitting models to data

Make every likelihood evaluation count.

Find the best-fitting parameters, the full posterior and the model evidence from a small budget of model evaluations, whether each one takes a fraction of a second or several minutes, and even when the likelihood is noisy or only available by simulation. In Python and MATLAB.

PyVBMC learning a banana-shaped posterior, drawn from a real run. Explore it

The tools

Ready to use

Fit your model

PyBADS BADS in MATLAB

Bayesian Adaptive Direct Search: fast, robust optimization for maximum-likelihood and MAP fits when the objective is rough, noisy or slow to evaluate, with up to about 20 parameters.

pip install pybads

Acerbi & Ma, NeurIPS 2017 · Singh & Acerbi, JOSS 2024

Get the posterior and the evidence

PyVBMC VBMC in MATLAB

Variational Bayesian Monte Carlo: an approximate posterior over your parameters and an estimate of the model evidence, for model comparison, from a small budget of likelihood evaluations, even noisy ones. Best with up to about 10 parameters.

pip install pyvbmc

Acerbi, NeurIPS 2018 and NeurIPS 2020 · Huggins, Li, Tobaben, Aarnos & Acerbi, JOSS 2023

When you can only simulate

PyIBS IBS in MATLAB

Inverse binomial sampling: unbiased, efficient estimates of the log-likelihood of models you can simulate but not write down, for data with discrete responses. Pair it with PyBADS or PyVBMC, which are built to handle noisy estimates.

pip install pyibs

van Opheusden, Acerbi & Ma, PLOS Computational Biology 2020

Next wave

Inference in a single forward pass

In active development

ACE and nanoACE

The Amortized Conditioning Engine: one transformer, trained on simulated data, that answers inference and prediction questions in a single forward pass and can take prior information at run time. It is research code in active development, and the start of our next generation of methods. nanoACE is a small, readable implementation with an in-browser playground.

Chang, Loka, Huang, Remes, Kaski & Acerbi, AISTATS 2025

In use

Fitting models across the sciences

Our tools started in cognitive science and neuroscience, where many of their users still are. They now fit models across the sciences and engineering. A few examples:

Story · Perception

One cause or two?

How does the brain decide whether a sight and a sound come from the same thing? A short film about causal inference in perception, and about a study whose models were fitted with BADS.

Help and news

Ask us, follow along

Questions about the tools, or how to use them for your model? Ask in our Discussions forum. New methods are on the way: follow Luigi to hear about releases and papers.