Open Family Office Datasets Tickers Strategies Portfolios Research Posts About Changelog

PyMC: Probabilistic Programming in Python

Source

Citation. Oriol Abril-Pla, Virgile Andreani, Colin Carroll, Larry Dong, Christopher J. Fonnesbeck, Maxim Kochurov, Ravin Kumar, Junpeng Lao, Christian C. Luhmann, Osvaldo A. Martin, Michael Osthege, Ricardo Vieira, Thomas Wiecki and Robert Zinkov. "PyMC: a modern, and comprehensive probabilistic programming framework in Python". PeerJ Computer Science 9, e1516, 2023. DOI 10.7717/peerj-cs.1516, and PMC10495961. The software is pymc-devs/pymc, version 6.4.0, released on 1 November 2026, under the Apache 2.0 licence. NumFOCUS supports it, and PyMC Labs, "a Bayesian consulting company, provides funding for the development of PyMC". Three authors work for PyMC Labs and three for Google. The paper still states that "the authors declare that they have no competing interests".

Status. Not applicable for now. Every metric in open_familyoffice/metrics.py already has an error (#8). The Sharpe ratio has Lo's error, Sortino has De Capitani's delta method, and a block bootstrap serves the rest. PyMC would bring PyTensor and a compiler toolchain for gains that the bootstrap and simple conjugate models mostly give. Two uses would justify it later, as an optional extra: shrinkage across many trials, and a posterior check of a paper record against its backtest.

Read. Read on 2026-11-28. PeerJ refused the fetcher (HTTP 403). So I read the full text from PubMed Central's XML, as plain text. I read the sections on the design, the samplers, prior and posterior predictive checks, the benchmark and the declarations. I didn't see the figures. I read version 6.4.0's pyproject.toml through the GitHub API, and I didn't run the package.

Summary

Claim. PyMC is a framework for Bayesian models in Python. It builds a model as a symbolic graph in PyTensor, and compiles the graph to C, JAX or Numba. Then it samples the posterior with NUTS or other methods. It also fits variational approximations.

Method.

Findings, as the source reports them.

Setting Number Value
A Bradley–Terry model of tennis players, 3,620 to 160,420 matches, 4 chains of 1,000 warm-up and 1,000 draws effective samples per second Stan (CmdStanPy) faster on small datasets, PyMC with JAX samplers faster on large ones
A two-parameter example time to sample 4 chains 3 seconds

The paper says the benchmark doesn't aim to be "exhaustive", only "an example of the attainable speed-ups".

Where the claims go beyond the evidence

The competing-interests statement. The paper declares no competing interests while three authors work for the consulting firm that funds the software. A reader should weigh the comparison with Stan in that light.

One benchmark. The speed comparison uses one model, from one outside source, averaged over four runs. It doesn't test the models that this project would fit: heavy-tailed returns, stochastic volatility or hierarchical shrinkage.

Diagnostics aren't a guarantee. The paper shows predictive checks and ArviZ's tools, but a sampler that hasn't converged can still return plausible numbers. Any result needs R-hat, effective sample size and divergence checks, and the paper doesn't set thresholds for them.

Credit. The paper explains the design plainly, and it says what the benchmark doesn't show. It treats prior predictive checks as part of building a model.

Use in this repo

Errors already exist. RQ2 asks for Sortino with an error (#29). metrics.sortino gives De Capitani's delta-method error, and metrics.bootstrapped gives a block bootstrap for any metric. A Bayesian posterior would add a full distribution, at the cost of a likelihood and a prior, which are two more choices to justify. For the common cases, a conjugate model in plain Python gives a posterior with no sampler. One example is a normal model of mean returns with a known prior.

Where a posterior adds something. First, a hierarchical model of many trials shrinks each trial's edge towards the group mean. That is a Bayesian answer to selection over many trials, beside the deflated Sharpe ratio and the haircut (open_familyoffice/haircut.py, #94). Second, a posterior predictive check asks how likely a paper record is under the backtest's posterior (#32, #236). If either becomes a goal, PyMC belongs in an optional extra, like the literature map's, not in the core package.

The cost. PyTensor compiles each model, and the compile step is the slow part. The hourly tick and the site build should never sample. Any Bayesian result would be computed once per evaluation, stored in the record, and read by the site.

Diagnostics before a result is shown. A Bayesian number should come with its R-hat, effective sample size and count of divergences. The site should refuse to show a result that fails them.

The prior is a trial. Each prior tried is a choice that changes the result, so it enters the trial ledger (#7), like any other setting (docs/literature/forking-paths.md).