5
$\begingroup$

Let me explain my meaning & the context:

  • I mean evaluating the correctness of the posterior (e.g. for approximate Bayesian inference methods).
  • I care mostly about Bayesian deep learning, I'd like a method that scales to very high dimensions & parameter count.
  • There are many methods available for classification (e.g. Brier score), I'm asking for something comparable for regression however.

One promising idea is the posterior predictive check but tbh I'm not sure how to implement this in a practical manner given that most Bayesian Models output samples rather than explicit pdfs...

Any ideas?

Posterior Predictive Check

$\endgroup$
11
  • $\begingroup$ What is inadequate about the Brier score you mentioned? $\endgroup$
    – Dave
    Commented Jul 13 at 19:57
  • 3
    $\begingroup$ It is simply false that Brier score only applies to pure classification. After all, $(1-0.8)^2$, for example, makes perfect sense. $\endgroup$
    – Dave
    Commented Jul 13 at 19:59
  • 1
    $\begingroup$ I recommend editing the question to reflect this explicitly, including a modification of the title to clarify what you mean. $\endgroup$
    – Dave
    Commented Jul 13 at 20:53
  • 2
    $\begingroup$ I recommend looking at Gelman et al 2013 and Vehtari et al 2024. $\endgroup$
    – Galen
    Commented Jul 13 at 21:17
  • 2
    $\begingroup$ From a calibration perspective, I recommend looking at Angelopoulos & Bates 2022 which have a section on combining Bayesian inference with conformal prediction. $\endgroup$
    – Galen
    Commented Jul 13 at 21:42

3 Answers 3

7
$\begingroup$

The method of choice to evaluate probabilistic predictions is a proper scoring rule. The Brier score is one such, for the special case of 0-1 outcomes - that is, classification. However, there are many proper scoring rules that apply to numerical predictions, whether interval or ordinal scaled. The most commonly used ones are probably the log score (which is also applicable to classification, and of course is essentially just the log-likelihood), or the continuous ranked probability score (CRPS).

The tag wiki contains pointers to literature describing proper scoring rules, and perhaps most importantly, to a paper by Merkle & Steyvers (2013) on how to choose between the different possibilities.

$\endgroup$
8
  • $\begingroup$ Thanks! But I'm concerned that you mention it's the log-likelihood. Does this method work if you only have samples of the posterior rather than an explicit function (e.g. MCMC)? I'm concerned because high dimensional pdf estimation is tricky (e.g. KDE doesn't scale well). $\endgroup$
    – profPlum
    Commented Jul 13 at 22:11
  • $\begingroup$ You have a point. In principle, proper scoring rules will by definition be minimized in expectation by the correct distribution... which will likely translate into some asymptotic statement if all we have is samples from our predictive distribution. No, I don't know of any work in this direction, sorry! $\endgroup$ Commented Jul 14 at 12:39
  • $\begingroup$ It's ok. I just learned in my case of mean-field variational inference for deep learning, you can apparently prove the distribution of posterior predictions (model outputs) will be gaussian which solves the problem for me. $\endgroup$
    – profPlum
    Commented Jul 14 at 16:48
  • 4
    $\begingroup$ That is not so! That is an asymptotic result, not a finite sample result! $\endgroup$
    – jbowman
    Commented Jul 14 at 17:24
  • $\begingroup$ Good point it's just a CLT approximation... But I'm not sure what else to do? $\endgroup$
    – profPlum
    Commented Jul 14 at 18:48
5
$\begingroup$

There are multiple senses of "correct" you may want to invoke.

A) - good predictions. If by "correct" you mean "has useful predictions", than cross validation (or better: validation on new external data), using a proper scoring rule is probably the way to go. A good proper scoring rule is the log predictive density - this is what is implemented in the loo package which provides ways to approximate leave-one-out cross-validation in an efficient manner. See also A. Vehtari's excellent Cross validation FAQ

Often it also makes sense to evaluate predictions by a scoring rule derived from your application (e.g. in business contexts you may want to try to evaluate the dollar cost/benefit of predictions).

B) - matches data. If by "correct" you mean "matches the true data-generating process", then posterior predictive checks (PPC) are a good way to go. Note that in practice PPCs are almost exclusively used with samples, so there should be no problem. You just take the samples of a quantity from your posterior and compare this distribution to the observed value of the quantity. If the observed value is extreme in respect to the posterior, it signals a problem.

See the section on PPCs in the Bayesian workflow preprint for some simple examples and some context (full disclosure, I am a co-author). The bayesplot package has further examples in their vignette on PPC.

C) correct computation. If by "correct" you mean "the computed posterior matches the theoretical posterior for the given model", then a strong (but computationally expensive) check is provided by simulation-based calibration checking (SBC, see Modrák et al., Bayesian analysis for a recent take on this, disclosure: I am the author). Checking prediction calibration (e.g. that 95% posterior credible interval contains the true value in 95% of the cases) can be understood as a special case of SBC - happy to elaborate more if that's what you are interested in. The linked paper surveys other possibilities. Since it was written, some closely related checks/extensions by Lemos et al. 2023, Yao & Domke 2023 came out.

Note that all of the three senses of "correct" are largely independent and one does not imply any of the others, i.e. your model may satisfy any arbitrary subset of those conditions.

$\endgroup$
7
  • 1
    $\begingroup$ Thanks for the variety of options. Regarding SBC is the purpose to validate all credible intervals simultaneously? I had an idea about how to approximate this but it's confusing in high dimensions what the best approach is. $\endgroup$
    – profPlum
    Commented Jul 14 at 21:28
  • 1
    $\begingroup$ The easiest (and typical) way is to look at various univariate projections/functions (test quantities) one at a time. The approach by Yao is a clever way to look at the full joint, but may require much more computation. The Lemos way is to choose a distance metric(s) which once again make the problem 1D. I think, but so far cannot prove that the "distance metrics" in Lemos approach actually correspond 1-to-1 to "test quantities" in SBC. $\endgroup$ Commented Jul 15 at 5:03
  • 1
    $\begingroup$ And yes, SBC validates all credible intervals simultaneously - the idea is that you look at the rank of the true (simulated) value within the posterior. The distribution of ranks is uniform if and only if all credible intervals are calibrated. $\endgroup$ Commented Jul 15 at 5:22
  • $\begingroup$ Omg that's so cool! I literally came up with that idea on my own. It's awesome to know that other people are using it too. I tried using the Lemos approach, but ya I'm not sure ofc that it is 100% valid. $\endgroup$
    – profPlum
    Commented Jul 15 at 19:03
  • 1
    $\begingroup$ I really encourage you to read the linked Bayesian analysis paper on SBC by me. I've spent a lit of time thinking through those things. Kernel estimates are generally a mess and rarely give you more than what you get by directly working with samples. However, using the posterior density as a test quantity in SBC turns out quite powerful (for reasons discussed in the paper) $\endgroup$ Commented Jul 16 at 4:25
2
$\begingroup$

Adding to Stephan Kolassa's answer, there are some (strictly) proper scoring rules for multivariate distributions which are particularly easy to compute (or rather one should say 'estimate') from realizations of the predictive distribution. One of them is the energy score (strictly speaking, this is the member of the energy score family with parameter $\beta = 1$, but this is often ignored) given by $$ S(F, y) = \mathbb{E}_F \Vert X - y \Vert - \frac{1}{2} \mathbb{E}_F \Vert X- X' \Vert $$ where $X$ and $X'$ are independent random vectors with distribution $F$. The energy score is in fact a generalization of the continuous ranked probability score (CRPS) to the multivariate case and it is strictly proper. For details see Strictly Proper Scoring Rules, Prediction, and Estimation by Gneiting and Raftery.

For more practical background you can have a look at Variogram-Based Proper Scoring Rules for Probabilistic Forecasts of Multivariate Quantities by Scheuerer and Hamill, who compare the energy score to other possible choices, in particular their Variogram score. Additionally, there is a method to compute the energy score in the R-package scoringRules, just search the manual for 'energy'.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.