Principle:Pyro ppl Pyro Deterministic Computation
| Knowledge Sources | |
|---|---|
| Domains | Probabilistic_Programming, Bayesian_Inference |
| Last Updated | 2026-02-09 00:00 GMT |
Overview
A principle for recording deterministic computations within probabilistic models so they appear in execution traces and can be accessed during posterior analysis.
Description
In probabilistic models, many quantities of interest are deterministic functions of the latent random variables rather than random variables themselves. For example, in a Bayesian regression model, the predicted mean is a deterministic function of the sampled coefficients and the input features. While these computed values are not random, they are often needed for posterior predictive analysis, model diagnostics, and visualization.
The deterministic computation principle provides a way to record such computed values in the model's execution trace, making them accessible to inference utilities like the Predictive class. Without this mechanism, users would need to manually recompute derived quantities from the posterior samples.
A deterministic site is treated as a sample site internally (with a Delta distribution), but it has zero entropy and does not contribute to the ELBO loss — it simply records a named value for later retrieval.
Usage
Use deterministic computations whenever a derived quantity needs to be accessible in the posterior. Common examples include: predicted means in regression, transformed parameters (e.g., log-odds to probability), and summary statistics computed from multiple latent variables. This is particularly useful with MCMC where posterior samples are collected and derived quantities need to be tracked.
Theoretical Basis
Given a deterministic function and latent variables :
This is equivalent to sampling from a Dirac delta distribution:
The log probability is zero: , so it does not affect the ELBO computation.