Skip to main content

Batteries-included Bayesian analysis template

Project description

https://zenodo.org/badge/344553551.svg Documentation Status Test Test Project Status: Active – The project has reached a stable, usable state and is being actively developed. Supported Python versions: 3.9 and newer https://badge.fury.io/py/bibat.svg https://codecov.io/github/teddygroves/bibat/branch/main/graph/badge.svg?token=ck0IKyzP7J pyOpenSci

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bibat-0.1.9.tar.gz (8.7 MB view hashes)

Uploaded Source

Built Distribution

bibat-0.1.9-py3-none-any.whl (8.8 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page