Conditioning¶
condition pairs a MonadicProgram with observed values for named sites and returns a
Conditioned model, which threads those observations through tracing and log joint evaluation
(conditioning on observations).
A forward run draws the remaining sites from their conditional priors and
records the scores, which an
inference algorithm uses to fit an approximation, reweight draws, or build a chain targeting the
posterior (Gelman et al., 2013).
conditioning
¶
Conditioning: pair a program with observed data.
The condition function wraps a MonadicProgram with a dict of
observations, producing a Conditioned object that threads those
observations through tracing and log-joint evaluation. This is the
primary interface for specifying observed data in inference.
Conditioned
¶
Conditioned(model: MonadicProgram, data: dict[str, Tensor])
A monadic program paired with observed data.
| PARAMETER | DESCRIPTION |
|---|---|
model
|
The generative model.
TYPE:
|
data
|
Observed variable names mapped to their observed values.
TYPE:
|
Source code in src/quivers/inference/conditioning.py
condition
¶
condition(model: MonadicProgram, data: dict[str, Tensor]) -> Conditioned
Condition a model on observed data.
| PARAMETER | DESCRIPTION |
|---|---|
model
|
The generative model.
TYPE:
|
data
|
Observed variable names mapped to their observed values.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Conditioned
|
Wrapped model with observations. |
Source code in src/quivers/inference/conditioning.py
Cited sources¶
Andrew Gelman, John B. Carlin, Hal S. Stern, David B. Dunson, Aki Vehtari, and Donald B. Rubin. Bayesian Data Analysis. Chapman and Hall/CRC, 3 edition, 2013. ISBN 9781439840955. URL: https://www.routledge.com/Bayesian-Data-Analysis/Gelman-Carlin-Stern-Dunson-Vehtari-Rubin/p/book/9781439840955.