Abstract
The Python package pyABC provides a framework for approximate Bayesian computation (ABC), a likelihood-free parameter inference method popular in many research areas. At its core, it implements a sequential Monte-Carlo (SMC) scheme, with various algorithms to adapt to the problem structure and automatically tune hyperparameters. This major update introduces advanced algorithms to accurately account for measurement noise, adaptively scale-normalize distance metrics, robustly handle data outliers, and utilize optimal transport-based distances. Furthermore, pyABC offers efficient parallelization strategies and interfaces for R, Julia, and specialized simulators like COPASI.
Introduction
In fields ranging from systems biology to cosmology, researchers rely on complex stochastic models to describe real-world phenomena. A critical step in using these models is parameter estimation via Bayesian inference. Traditional methods require a "likelihood function"—the probability of observing data given a set of parameters. However, for many modern models, this likelihood is "intractable," meaning it is either impossible to derive or computationally prohibitive to evaluate.
Approximate Bayesian Computation (ABC) addresses this by replacing the likelihood with simulations. By running a model with candidate parameters and comparing the simulated output to observed data, ABC accepts parameters that produce "close enough" results.
The ABC Framework
The core mechanism of pyABC is built around a Sequential Monte-Carlo (SMC) scheme. Rather than a single massive simulation run, it evolves a population of parameter guesses through multiple generations, progressively narrowing the search space toward the most likely values.
As shown in the figure above, the process involves sampling parameters $\theta$, running them through a model, and calculating summary statistics $s$. These are compared to observed data using a distance metric $d$. If the distance is within a threshold $\epsilon$, the parameters are accepted.
Advanced Features and Innovations
The latest update to pyABC introduces several technical innovations designed to improve the efficiency and robustness of inference:
- Adaptive Scale-Normalization: This feature automatically adjusts distance weights. It ensures that data points on different scales (e.g., one measured in meters and another in millimeters) do not disproportionately bias the inference results.
- Robustness to Outliers: New algorithms identify and down-weight "noisy" data points that do not align with the model's underlying logic, preventing outliers from skewing parameter estimates.
- Optimal Transport (Wasserstein) Distances:
pyABCnow supports Wasserstein distances, allowing for sophisticated data comparison without the need for manually selected summary statistics, which can often be error-prone. - Regression-Based Informativeness: By utilizing machine learning models (via scikit-learn), the framework can identify which components of the data are most informative for the estimation process.
- Dynamic Scheduling: To handle computationally expensive simulations,
pyABCmanages parallel tasks dynamically across multi-core or distributed systems. This approach significantly reduces "wall-time" compared to static task allocation.
Interoperability and Standards
A key strength of pyABC is its modularity and broad compatibility. It is not limited to Python-based models; it provides robust interfaces for the R and Julia languages. This allows researchers to leverage Python's optimization and parallelization ecosystem while maintaining existing models in other languages.
Furthermore, the package supports industry standards such as PEtab and SBML/COPASI, which are widely used in systems biology. This integration facilitates the use of specialized simulators like AMICI and COPASI within the ABC framework.
Conclusion
pyABC represents a significant step forward in making likelihood-free inference accessible and scalable. By automating hyperparameter tuning and providing advanced distance metrics, it reduces the manual effort required for complex Bayesian tasks. While ABC remains simulation-heavy, the framework's efficient parallelization and adaptive algorithms make it a powerful tool for modern scientific modeling.
Paper Citation: Schälte et al., (2022). pyABC: Efficient and robust easy-to-use approximate Bayesian computation. Journal of Open Source Software, 7(74), 4304. https://doi.org/10.21105/joss.04304
Summary updated