Package: yabf
Yet Another Bayesian FrameworkFree software: MIT licenseDocumentation:https://yabf.readthedocs.io.FeaturesWhy another Bayesian Framework? There are a relativehostof Bayesian codes in
Python, including major players such asPyMC3,emceeandstan, as well as a
seemingly never-ending set of scientific-field-specific codes (eg. cosmology
hasCosmoMC,CosmoHammer,MontePython,cobaya…).yabfwas written because the author found that all the frameowrks they tried
were either too lean or too involved.yabftries to find the happy medium.
It won’t be the right tool for everyone, but it might be the right tool for you.yabfis designed to support “black box” likelihoods, by which we mean those
that don’t necessarily have analytic derivatives. This separates it from codes
such asPyMC3andstan, 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 likeemceeorpolychord.On the other hand,yabfisnotanother MCMC sampler. Apart from the
limitations concerning likelihood derivatives, it is sampler-agnostic. It is
rather aspecificationof 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,yabfismore likePyMC3orstan, and unlikeemceeorpolychord.yabfis perhaps most similar to codes such asCosmoHammerorcobaya,
which provide an interface for creating (cosmological) likelihoods which can
then be sampled by somie specified sampler. However,yabfis different in
that it isintendedto 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 thatyabfprovides 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’tneedto 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-builtComponentorLikelihoodclasses, 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.CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.Many of the ideas in this code are adaptations of other MCMC codes, especiallyCosmoHammerandcobaya.