Skip to main content

Release build Develop build Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. License: MIT

New View of MCMC

Backfillz-py provides new visual diagnostics for understanding MCMC (Markov Chain Monte Carlo) analyses and outputs. MCMC chains can defy a simple line graph. Unless the chain is very short (which isn’t often the case), plotting tens or hundreds of thousands of data points reveals very little other than a ‘trace plot’ where we only see the outermost points. Common plotting methods may only reveal when an MCMC really hasn’t worked, but not when it has. BackFillz-py slices and dices MCMC chains so increasingly parameter rich, complex analyses can be visualised meaningfully. What does ‘good mixing’ look like? Is a ‘hair caterpillar’ test verifiable? What does a density plot show and what does it hide?

Quick Start

Install from PyPI using pip install backfillz.

from backfillz import Backfillz

# Let's have an example Stan model.
from backfillz.example.eight_schools import generate_fit

backfillz = Backfillz(generate_fit().fit)

# Plot some of the available plot types.
backfillz.plot_slice_histogram('mu')
backfillz.plot_trace_dial('theta')
backfillz.plot_spiral_stream('mu', [2, 8, 15, 65, 250, 600])

See the example notebook for running in JupyterLab.

Current supported plot types

Pretzel Plot – plot_trace_dial()

This plot shows the chain and summary histograms in a format that can be easily arranged as a grid. The trace plot is stretched, clearly indicating ‘burn-in’, with density plots showing the burn-in and remainder of the chain in context.

Slice plot - plot_slice_histogram()

By partitioning chain slices, in a faceted view, users can assess chain convergence. The slices are currently specified by the user and display density plots for each slice. Have my chains converged? The slice plot offers a clear view of when and how convergence is achieved. Further statistical diagnostics can be embedded in these plots as colour encodings or additional layers and annotations.

Splash plot - plot_spiral_stream()

Based on a Theodorus spiral, we turn MCMC chains into glyphs and extract properties to answer – What does ‘good mixing’ look like? In these plots variance windows are calculated across chains and parameters. The glyphs have clear diagnostic features and will allow gridded plots to investigate large numbers of parameters.

Emojis on commit messages

Recent commits use the following git aliases (add to [alias] section of your .gitconfig):

doc      = "!f() { git commit -a -m \"📚 : $1\"; }; f"
lint     = "!f() { git commit -a -m \"✨ : $1\"; }; f"
modify   = "!f() { git commit -a -m \"❗ : $1\"; }; f"
refactor = "!f() { git commit -a -m \"♻️ : $1\"; }; f"

Acknowledgements

We are grateful for funding from the Alan Turing Institute within the Tools, Practices and Systems theme. Initial user research was carried out by GJM on the 2020 Science programme funded by the EPSRC Cross-Discipline Interface Programme (grant number EP/I017909/1).

Metadata

Release files for backfillz 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for backfillz 0.2.4
File Size Uploaded
backfillz-0.2.4.tar.gz 16.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for backfillz 0.2.4
File Interpreter ABI Platform
backfillz-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 36.3 kB

Release files / backfillz-0.2.4.tar.gz

Download URL backfillz-0.2.4.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
45474cbf77ebb0a305258b326e5f28888b229e8347cd322dd6c0ce46b959ead3
BLAKE2b-256 checksum
How to use checksums
8e0e3a1e0f1f3b00966aa684a2889d8d312e3d1b31e8e8dca05c9b08b1ec82bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.9.6 Darwin/19.6.0

Release files / backfillz-0.2.4-py3-none-any.whl

Download URL backfillz-0.2.4-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e2c9d326a97f4db33b135aa2b09a26a4cac24d0ddaa9afe6b2316557164fd4c
BLAKE2b-256 checksum
How to use checksums
cae8570c4e64d5919ef818de008cd9b5c265170d6d95af32799bcf12cf066ced
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.9.6 Darwin/19.6.0

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.7

2 release files

0.0.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page