Pith. sign in

REVIEW 6 minor 2 cited by

fgivenx: A Python package for functional posterior plotting

T0 review · 0 major / 6 minor · reviewed 2026-08-14 · deepseek-v4-flash

Pith's one-line read fgivenx is a Python package that turns MCMC parameter samples into contour plots of the predictive probability $P(y|x)$, plus the conditional Kullback-Leibler divergence between prior and posterior predictions.

desk verdict A solid little software paper: the package is real and usable, the paper is honest about what it does, and the only real weakness is the lack of in-paper validation, which is standard for JOSS. read the letter →

arxiv 1908.01711 v1 pith:BDYT63SF submitted 2019-08-02 astro-ph.IM

classification astro-ph.IM
keywords functionalposteriorpredictivedistributionkerneldensityestimationKullback-LeiblerdivergenceBayesiananalysisMCMCsamplesPythonpackagedatavisualization
verification ladder T0 review T1 audit T2 compute T3 formal

The pith

A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.

The reading

fgivenx is a Python package that visualizes functional posteriors: given samples from the posterior distribution of a model's parameters, it plots the probability $P(y|x)$ that the model's predicted output $y$ takes a given value at each input $x$. The package also computes the conditional Kullback-Leibler divergence between the prior and posterior predictive distributions, showing where data most change the prediction. The paper's central claim is that this provides a general tool for any Bayesian analysis with functional predictive posteriors, not just the cosmological examples where it has already been used. A sympathetic reader would care because parameter-posterior contour packages answer only 'what do we know about the parameters?' while functional posterior plots answer 'what do we know about the thing the model predicts?'

What carries the argument

The load-bearing mechanism is a sequence of one-dimensional kernel density estimates (smooth histograms built by placing a bump on each sampled value) taken across a grid of $x$, rather than a single high-dimensional density estimate. For each value of $x$ on the grid, the package pushes all posterior parameter samples through the function $f(x)$, collects the output values $y$, and estimates the density of those outputs to build $P(y|x)$. This turns functional posterior plotting into repeated one-dimensional density estimation, which is stable and cheap; the conditional Kullback-Leibler divergence is then computed from the estimated prior and posterior densities at each $x$.

What would settle it

Run the package's linear-model example with a known Gaussian prior on the slope and intercept, and compare its $P(y|x)$ contours and conditional Kullback-Leibler divergence against the analytically derived posterior predictive distribution; any systematic mismatch in the quantiles or divergence values would show the central claim is wrong.

Watch

Extended reading notes

Core claim

On its own terms, the paper establishes that functional posterior plotting can be packaged as a small, reusable library. The core operation is: take a set of posterior samples of parameters, evaluate the model function $f(x)$ on a grid of $x$ for each sample, and at every grid point perform one-dimensional kernel density estimation over the resulting $y$ values to obtain $P(y|x)$. The package then renders these densities as iso-probability contours (67%, 95%, and 99%) and plots the conditional Kullback-Leibler divergence $\mathrm{D}_{\mathrm{KL}}[P(y|x) \,\|\, P_{\rm prior}(y|x)]$ as a function of $x$. The linear model $y=mx+c$ with prior and posterior samples serves as the demonstration, and the applications listed include cosmological power-spectrum constraints and diagnostics for nested-sampling and compressive-sensing analyses.

Load-bearing premise

The paper assumes without showing tests or worked validation that the archived code actually computes the posterior density and Kullback-Leibler divergence correctly for arbitrary input samples.

Editorial extensions

If this is right

  • Scientists with existing MCMC samples of any model can produce publication-ready functional posterior plots without writing their own density-estimation code.
  • The conditional Kullback-Leibler divergence plot provides a one-dimensional diagnostic for where the data most strongly update model predictions, useful for model comparison and for spotting regions of $x$ where the prior dominates.
  • Because the method only assumes predictive outputs that are functions of an input $x$, it transfers to any field doing Bayesian prediction, not just astronomy.
  • The listed applications in cosmology, dark-energy studies, nested-sampling diagnostics, and compressive sensing indicate that the package already works in several demanding inference settings.

Reading between the lines

Editorial extensions of the paper, not claims the author makes directly.

  • [Editorial inference] The same machinery could compare two posterior predictive distributions from different datasets or models by replacing the prior with a second posterior ensemble, yielding a data-versus-data divergence plot the paper does not discuss.
  • [Editorial inference] Because the method reduces to independent one-dimensional kernel density estimates, its practical reliability hinges on the grid resolution in $x$ and the kernel bandwidth in $y$; a natural testable extension is to expose or automate bandwidth selection and to validate contours on analytic posteriors.
  • [Editorial inference] The package could serve as a standard visual check in Bayesian workflow, complementing trace plots and parameter contours by exposing where the model's predictions are updated; this would matter for any field using black-box likelihoods.
Share X Bluesky LinkedIn Reddit HN

Signed reviews

No signed human review yet.

Editorial analysis

A structured set of objections, weighed in public.

Desk editor's note, referee report, and a circularity audit.

Referee Report

0 major / 6 minor

Summary. The manuscript describes fgivenx, a Python package for plotting functional posterior distributions P(y|x) and conditional Kullback-Leibler divergences from samples of model parameters. It presents a simple linear-model example (Figure 2), a Planck-based demonstration (Figure 1), and a list of published applications in cosmology and Bayesian analysis. The software is archived with a Zenodo DOI and the source is available on GitHub.

Significance. If the package works as claimed, it provides a useful and reusable tool for Bayesian functional posterior visualization, with demonstrated uptake in Planck analyses, dark-energy equation-of-state studies, and nested-sampling diagnostics. The paper's strengths are its modest scope, the archived code (v2.1.17, DOI 10.5281/zenodo.1404584) that can be machine-checked, and a reproducible linear-model example. The lack of in-paper numerical validation is a caveat, but the package's public archive and published usage make this a standard software-paper limitation rather than a defect that undermines the central claim.

minor comments (6)
  1. [Summary] The manuscript does not specify the algorithm used to compute P(y|x) and the conditional Kullback-Leibler divergence (e.g., kernel density estimation procedure, bandwidth selection, grid construction); a brief description or a pointer to the relevant module in the archived code would help readers assess the numerical accuracy independently of running the code.
  2. [Figure 2] In the caption, 'essential a contour version' should be 'essentially a contour version'.
  3. [Abstract / Summary] The GitHub URL appears only in the abstract; include it in the main text so the paper is self-contained and readers do not need to consult the abstract to find the repository.
  4. [Summary] The sentence 'currently used in astronomy, but will be of use to scientists performing any Bayesian analysis...' is informal and could be rephrased as 'already used in astronomy, and should be of use to scientists...' for clarity.
  5. [Acknowledgements] The paper does not state the software's license; since the software is the main artifact, please state the package's license (e.g., MIT, GPL) alongside the CC-BY license that applies to the paper.
  6. [References] Some references are to arXiv e-prints without a DOI or final publication status (e.g., Higson et al. 2018a, 2018b); consider updating to the published versions or adding DOIs where available.

Circularity Check

0 steps flagged · score 0.0 of 10

No circularity found; the paper is a standalone software description with no fitted-input prediction chain.

full rationale

This is a software tool paper, not a derivation of a physical or statistical result from fitted inputs. The paper describes fgivenx as a Python package for functional posterior plotting, illustrates its use with a linear model y = m*x + c, and cites prior applications (Planck studies, dark energy equation of state, nested-sampling diagnostics, Bayesian compressive sensing) as usage examples rather than as evidence that validates the package's algorithms. There is no equation in the paper that is defined in terms of the paper's own output, no parameter fitted to a subset of data and then renamed as a prediction, and no self-citation chain that makes the central claim true by construction. The central claim is simply that the package exists, is archived on Zenodo with a DOI, and can produce the depicted functional posterior plots. The lack of in-paper numerical tests is a legitimate weakness, but it is a matter of validation and provenance, not circularity: the correctness of the implementation rests on the archived code and external usage, not on any argument that assumes what it purports to show. The score is therefore 0.

Assumptions & free parameters 0 free parameters · 2 assumptions · 0 invented entities

The package itself is an implementation tool; it does not introduce new physical entities or fit parameters. The central assumptions are that input samples are valid and that kernel density estimation gives a faithful representation of the conditional posterior. No free parameters or invented entities are required beyond the software's internal settings.

assumptions (2)
  • domain assumption Input samples are valid draws from the requested posterior or prior distribution.
    The package takes samples as inputs and plots functional posteriors; the output is only as valid as the input samples. The paper states this in Figure 2: 'provided some prior and posterior samples'.
  • domain assumption Kernel density estimation on the function output grid accurately represents the continuous conditional posterior P(y|x).
    The package produces P(y|x) maps; the accuracy depends on kernel bandwidth and grid resolution, which the paper does not discuss or validate. This is an unstated modeling assumption for all the plotted results.

how reviews work

0 comments
Cite this review

Pith. "Pith review of fgivenx: A Python package for functional posterior plotting." pith.science (2026). https://pith.science/paper/BDYT63SF

@misc{pith2026190801711,
  author       = {Pith},
  title        = {Pith review of: fgivenx: A Python package for functional posterior plotting},
  year         = {2026},
  howpublished = {\url{https://pith.science/paper/BDYT63SF}},
  note         = {Machine review of arXiv:1908.01711}
}
read the original abstract

fgivenx is a Python package for functional posterior plotting, currently used in astronomy, but will be of use to scientists performing any Bayesian analysis which has predictive posteriors that are functions. The source code for fgivenx is available on GitHub at https://github.com/williamjameshandley/fgivenx

Figures

Figures reproduced from arXiv: 1908.01711 by the authors.

Figure 1
Figure 1. The age and size of the universe, as measured using Planck 2018 data. (non-Astro)Physicists may note that 14 Gigaparsecs is roughly 46 billion light years. The fact that the observable universe is roughly three times larger in light years in comparison with its age is explained by the expansion of space over cosmic history. Contours indicate 67% and 95% marginalised iso-probability credibility regions. References Bo… view at source ↗
Figure 2
Figure 2. Example output of fgivenx provided some prior and posterior samples and a linear test function. Top-left: underlying parameter covariances between m and c for realizations from the prior (blue) and from the posterior (red). Top-right realisations function y=m*x+c. Bottom-left: The conditional Kullback-Leibler divergence. Bottom-right: The probability of measuring y for a given x, essential a contour version of the p… view at source ↗

Discussion (0). Continue with ORCID to comment.

Forward citations

Cited by 2 Pith papers

Reviewed papers in the Pith corpus that reference this work. Sorted by Pith novelty score. Full citation record

  1. MIGHTEE-HI / LADUMA: Investigating the link between baryons and dynamics with 130 resolved HI-selected galaxies

    astro-ph.GA 2026-08 conditional novelty 6.0 of 10

    A 130-galaxy HI-selected sample yields a tight radial acceleration relation with an acceleration scale near 1.5e-10 m/s^2 and a MOND shape parameter around 4, and shows that the bTFR redshift-evolution signal is large...

  2. A NICER view of the millisecond pulsar PSR J2124$-$3358: evidence for a helium atmosphere

    astro-ph.HE 2026-07 conditional novelty 5.5 of 10

    X-PSI modeling of NICER/Chandra data for PSR J2124−3358 substantially prefers a helium atmosphere, giving M = 1.8 ± 0.5 M⊙ and Req = 11.7^{+2.6}_{-3.0} km with two slightly non-antipodal hot spots.

Reference graph

Works this paper leans on

10 extracted references · 3 canonical work pages · cited by 2 Pith papers

  1. [4]

    Bayesian model selection without evidences: application to the dark energy equation-of-state

    “Bayesian model selection without evidences: application to the dark energy equation-of-state.”MNRAS 455 (January): 2461–73. https://doi.org/10.1093/mnras/stv2217. Hee, S., J. A. Vázquez, W. J. Handley, M. P. Hobson, and A. N. Lasenby

  2. [6]

    Sampling Errors in Nested Sampling Parameter Estimation

    “Sampling Errors in Nested Sampling Parameter Estimation.”ArXiv E-Prints, March. http://arxiv.org/abs/1703.09701. ———. 2018b. “Diagnostic Tests for Nested Sampling Calculations.”ArXiv E-Prints, April. http://arxiv.org/abs/1804.06406. Handley, (2018). fgivenx: A Python package for functional posterior plotting. Journal of Open Source Software , 3(28),

  3. [11]

    Planck 2015 results. XX. Constraints on inflation

    “Planck 2015 results. XX. Constraints on inflation.”A&A 594 (September): A20. https://doi.org/10.1051/0004-6361/201525898. ———. 2018a. “Planck 2018 results. I. Overview and the cosmological legacy of Planck.” ArXiv E-Prints, July. http://arxiv.org/abs/1807.06205. ———. 2018b. “Planck 2018 results. X. Constraints on inflation.”ArXiv E-Prints, July. http://arx...

  4. [12]

    https: //doi.org/10.21105/joss.00849 4

  5. [24]

    Handley, W

    https://doi.org/10.21105/joss.00024. Handley, W

  6. [1951]

    On Information and Sufficiency

    “On Information and Sufficiency.”Ann. Math. Statist. 22 (1): 79–86. https://doi.org/10.1214/aoms/1177729694. Lewis, Anthony

  7. [2015]

    Getdist Github Repository

    “Getdist Github Repository.” https://github.com/cmbant/getdist. MacKay, David J. C. 2002.Information Theory, Inference & Learning Algorithms . New York, NY, USA: Cambridge University Press. Planck Collaboration

  8. [2016]

    Pygtc: Beautiful Parameter Covariance Plots (Aka. Giant Triangle Confusograms)

    “Pygtc: Beautiful Parameter Covariance Plots (Aka. Giant Triangle Confusograms).”The Journal of Open Source Software 1 (6). https://doi.org/10.21105/joss.00046. Foreman-Mackey, Daniel

Show all 10 references
  1. [2017]

    Con- straining the dark energy equation of state using Bayes theorem and the Kullback-Leibler divergence

    “Con- straining the dark energy equation of state using Bayes theorem and the Kullback-Leibler divergence.”MNRAS 466 (April): 369–77. https://doi.org/10.1093/mnras/stw3102. Higson, E., W. Handley, M. Hobson, and A. Lasenby. 2018a. “Bayesian Sparse Recon- struction: A Brute-For...

  2. [2018]

    Fgivenx: V2.1.17,

    “Fgivenx: V2.1.17,” August. https://doi.org/10.5281/zenodo.1404584. Hee, S., W. J. Handley, M. P. Hobson, and A. N. Lasenby

Pith tools

Reviewed August 14, 2026 · model on record in the stance chip above.