Batteries-included Bayesian analysis template
Project description
Bibat is a Python package providing a flexible interactive template for Bayesian statistical analysis projects.
It aims to make it easier to create software projects that implement a Bayesian workflow that scales to arbitrarily many inter-related statistical models, data transformations, inferences and computations. Bibat also aims to promote software quality by providing a modular, automated and reproducible project that takes advantage of and integrates together the most up to date statistical software.
Bibat comes with “batteries included” in the sense that it creates a working example project, which the user can adapt so that it implements their desired analysis. We believe this style of template makes for better usability and easier testing of Bayesian workflow projects compared with the alternative approach of providing an incomplete skeleton project.
Documentation
Check out bibat’s documentation at https://bibat.readthedocs.io.
In particular, you may find it useful to have a look at this vignette that demonstrates, step by step, how to use bibat to implement a complex statistical analysis.
Installation
You can install bibat like this (make sure you are in a Python environment where you would like to install bibat):
$ pip install bibat
To install the latest version of bibat from github:
$ pip install git+https://github.com/teddygroves/bibat.git@main
To install bibat with development dependencies:
$ pip install bibat'[development]'
Usage
Bibat is intended to be used from the command line like this:
$ bibat
Running this command will trigger a command line wizard. After following the wizard’s instructions, a new directory will be created that implements a simple statistical analysis. To try out the example analysis, run the following command from the root of the new directory:
$ make analysis
If you already know how you are going to answer the wizard’s questions, you can put your answers in a json file with relative path my_json_file.json and run bibat like this:
$ bibat --config_file=my_json_file.json
See bibat’s cookiecutter schema for the information you need to create a suitable json file.
Dependencies
Bibat’s dependencies fall into two categories: a few that are required by bibat itself, and some more that are required in order to run the analyses that bibat generates.
Dependencies required by bibat
Bibat requires Python version 3.9 or greater.
Bibat’s other dependencies are all Python packages. These can be found in bibat’s pyproject.toml file.
The following packages are required in order to run bibat and are installed
automatically when you run pip install bibat
:
cookiecutter
click
pydantic
Bibat also has the following development dependencies, which can be installed
by running pip install bibat'[development]'
:
black
isort
pre-commit
pytest
tox
codecov
pytest-cov
sphinx
sphinx-click
pydata_sphinx_theme
Target project dependencies: Python
Projects generated by bibat have their Python dependencies listed in the file
pyproject.toml
. The cookiecutter template that generates this file can
be found here.
These packages will be installed when you run make env
or make analysis
and are as follows:
arviz
cmdstanpy
jupyter
numpy
pandas
pandera
pydantic
scipy
scikit-learn
toml
In addition, the following Python packages may be installed, depending on how the user answers bibat’s wizard:
pytest
black
sphinx
Target project dependencies: Cmdstan
Bibat will attempt to install cmdstan, the command line
interface to Stan, when you run the commands make env
or make analysis
from the root of the target project.
If bibat fails to install cmdstan, please raise an issue! The relevant parts of the cmdstan and cmdstanpy documentation might also be useful.
Target project dependencies: Quarto
Bibat supports automatic generation of documentation using either Sphinx or Quarto. Whereas bibat will install Sphinx automatically, Quarto must be installed manually: see the quarto documentation for instructions.
Citation information
If you would like to cite bibat using bibtex please use the following format:
@software{bibat,
doi = {10.5281/zenodo.7775328},
url = {https://github.com/teddygroves/bibat},
year = {2023},
author = {Teddy Groves},
title = {Bibat: batteries-included Bayesian analysis template},
}
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.