Skip to main content

Module stack

Module stack 

Source
Expand description

Model weights for blending from pointwise out-of-sample log predictive densities: stacking and pseudo-BMA (Yao, Vehtari, Simpson and Gelman, 2018, “Using stacking to average Bayesian predictive distributions”).

The input is, for each model, the log predictive density of each observation when that observation was held out: PSIS-LOO pointwise values for a Bayesian fit (prospicio_bayes::elpd), or cross-validated log densities (Family::log_density on each test fold) for any other model. So the weights apply to every engine, Bayesian or not. Blend the models’ predictive distributions with prospicio_prob::PredictiveDistribution::blend.

Functions§

pseudo_bma_weights
Pseudo-BMA weights: w_k ∝ exp(elpd_k), with elpd_k = Σ_i lpd_ik.
stacking_weights
Stacking weights: the w on the simplex that maximizes Σ_i log Σ_k w_k exp(lpd_ik), the log score of the mixture of the models’ predictive distributions. lpd[k][i] is model k’s held-out log density of observation i.