Yet Another Bayesian Framework
Project description
Yet Another Bayesian Framework
Free software: MIT license
Documentation: https://yabf.readthedocs.io.
Features
Why another Bayesian Framework? There are a relative host of Bayesian codes in Python, including major players such as PyMC3, emcee and stan, as well as a seemingly never-ending set of scientific-field-specific codes (eg. cosmology has CosmoMC, CosmoHammer, MontePython, cobaya…).
yabf was written because the author found that all the frameowrks they tried were either too lean or too involved. yabf tries to find the happy medium. It won’t be the right tool for everyone, but it might be the right tool for you.
yabf is designed to support “black box” likelihoods, by which we mean those that don’t necessarily have analytic derivatives. This separates it from codes such as PyMC3 and stan, and limits its use to samplers that do not require that information. This is more often the case in scientific applications, where likelihoods can in principle depend on some enormous black-box simulation code. Thus, in this regard it is more like emcee or polychord.
On the other hand, yabf is not another MCMC sampler. Apart from the limitations concerning likelihood derivatives, it is sampler-agnostic. It is rather a specification of a format, and an implementation of that specification. That is, it specifies that likelihoods should have certain properties (like parameters), and gives tools that enable that. Or as another example, it specifies that samplers should contain certain attributes pre- and post-sampling. In this regard, yabf is more like PyMC3 or stan, and unlike emcee or polychord.
yabf is perhaps most similar to codes such as CosmoHammer or cobaya, which provide an interface for creating (cosmological) likelihoods which can then be sampled by somie specified sampler. However, yabf is different in that it is intended to be field-agnostic, and entirely general. In addition, I found that these codes didn’t quite satisfy my criteria for ease-of-use and extensibility.
I hope that yabf provides these. Here are a few of its features:
Deisgn is both DRY/modular and easy-to-use: while components of the model can be separately defined (to make it DRY), they don’t need to be combined into a rigid structure in order to perform most calculations. This makes it easy to evaluate partial models for debugging.
Extremely extensible: write your own class that subclasses from the in-built Component or Likelihood classes, and it is immediately useable.
Parameters are attached to to the model, for encapsulation, but they can be specified at run-time externally for modularity.
Models are heirarchical, in the sense that parameters may be specified at any of three levels, and they are propagated through the model heirarchy (note that this doesn’t refer to heirarchical parameters, i.e. parameters that depend on other parameters).
Parameters can be set as fixed or constrained at run-time.
Models are well-specified, in the sense that they can be entirely specified by a YAML file (and/or written to YAML file), for reproducibility.
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Many of the ideas in this code are adaptations of other MCMC codes, especially CosmoHammer and cobaya.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file yabf-2.0.0.tar.gz
.
File metadata
- Download URL: yabf-2.0.0.tar.gz
- Upload date:
- Size: 44.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46a3ddefef07a9ee10f8a4a94b8d785f94835a19d9a3e75ecbfe2f96b40de836 |
|
MD5 | eeccee00496f28f0b7ae7cd9c4b6daee |
|
BLAKE2b-256 | 1bf01c5557e825b5a91921f5d197492837437ea51f2364605f537e04aecd1488 |
File details
Details for the file yabf-2.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: yabf-2.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 33.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 539d45d0d9d35e65dfe80463ef1147e9e5be25270b19c9a7c4dc1ee8cda7c058 |
|
MD5 | 6ad75915a29477964da720c83f396ef7 |
|
BLAKE2b-256 | a1a8b8580c881b0f0302ff34bdef91efd4f0c13e069a11f8343f9a9ad220ee42 |