Bayesian Observation Models and Posterior Update #
General-purpose infrastructure for Bayesian reasoning with stochastic
observations. An ObservationModel specifies how experiments generate
observations in different worlds; posterior computes the Bayesian update.
Key Results #
posterior_nonneg: posteriors inherit non-negativity from priorsposterior_sum_one: posteriors sum to 1 (when marginal is nonzero)posterior_marginalizes_to_prior: the law of total probability — marginalized posteriors reconstruct the prior:∑ o, P(o|e) · P(w|o,e) = prior(w)
Usage #
This module is imported by ExperimentDesign.lean (for EIG computation)
and can be imported independently wherever Bayesian updating is needed.
An observation model: how experiments generate observations in different worlds. P(o|w,e) — the probability of observing o when the true world is w and experiment e is conducted.
- likelihood : W → E → O → ℝ
Likelihood: P(o|w,e)
Likelihood is non-negative
Likelihood sums to 1 for each (w,e)
Instances For
Marginal probability of observation o under experiment e: P(o|e) = Σ_w prior(w) · P(o|w,e)
Equations
- Core.BayesianUpdate.marginalObs om prior e o = ∑ w : W, prior w * om.likelihood w e o
Instances For
Bayesian posterior after observing o under experiment e: P(w|o,e) = prior(w) · P(o|w,e) / P(o|e)
Equations
- Core.BayesianUpdate.posterior om prior e o w = if Core.BayesianUpdate.marginalObs om prior e o = 0 then 0 else prior w * om.likelihood w e o / Core.BayesianUpdate.marginalObs om prior e o
Instances For
Marginal observation probability is non-negative when prior is.
Posterior sums to 1 when marginal is nonzero and prior is non-negative.
The law of total probability for posteriors: marginalized posteriors reconstruct the prior.
Σ_o P(o|e) · P(w|o,e) = prior(w)
This is the key identity underlying EIG non-negativity.
A deterministic observation model from a classifier: each world produces exactly the observation corresponding to its classification.
This is the partition-cell case: classify assigns each world to a cell,
and the observation reveals which cell the world belongs to.