You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ensemble potential() and joint map() mix unnormalized component potentials #2135
EnsemblePotential.__call__ (sbi/inference/posteriors/ensemble_posterior.py) returns the weighted log-sum-exp of its components' potentials. A mixture of posteriors needs normalized component densities. NLE and NRE potentials are unnormalized, and so are NPE potentials with several iid observations (issue #2125). Each component then enters the mixture with its own normalization constant, so the ensemble's potential() and joint map() disagree with sample(), which draws each component in proportion to its weight.
Example in plain math: components q₁(θ|x) = N(x, 1) and q₂(θ|x) = N(5x + 5, 1), prior N(0, 10²), iid observations 0 and 1, weights 1:3. The mode of the weighted iid potentials is 0.50; the mode of the mixture of the normalized posteriors is 7.54.
Fix direction: normalize each component before mixing (the importance posterior already estimates log normalization constants), or raise when a component is unnormalized. sample() and map(individually=True) are correct and should stay as they are.
The same mix also happens in two places the issue does not list yet:
log_prob(): MCMC and rejection posteriors return their unnormalized potential there, so an ensemble of NLE or NRE posteriors mixes unnormalized values in log_prob() too.
Importance posteriors normalize their log_prob() per x, so their ensembles are fine there. So the fix should cover log_prob() as well, and check per component whether its values are normalized.
Once PR #2140 is merged, the ensemble raises in potential(), log_prob() and the joint map() for several observations when a component has an NPE or vector field potential. In log_prob(), this also blocks importance and single-x VI components, although their log_prob() is normalized per x and their mixture would be correct. The per-component check above should lift that restriction as well.
Activity
fix: raise for several observations in an NPE ensemble's potential() …
janfb commentedon Nov 10, 2026
The same mix also happens in two places the issue does not list yet:
log_prob(): MCMC and rejection posteriors return their unnormalized potential there, so an ensemble of NLE or NRE posteriors mixes unnormalized values inlog_prob()too.log_prob()onmain, and inpotential()once PR fix: count iid trials by the observation shape, and combine iid observations in the sampling posteriors #2140 lets it take several observations.Importance posteriors normalize their
log_prob()per x, so their ensembles are fine there. So the fix should coverlog_prob()as well, and check per component whether its values are normalized.fix: an ensemble with vector field posteriors takes one observation i…
janfb commentedon Nov 18, 2026
Once PR #2140 is merged, the ensemble raises in
potential(),log_prob()and the jointmap()for several observations when a component has an NPE or vector field potential. Inlog_prob(), this also blocks importance and single-x VI components, although theirlog_prob()is normalized per x and their mixture would be correct. The per-component check above should lift that restriction as well.fix: count iid trials by the observation shape, and combine iid obser…