Description
The goal of this issue is to discuss interfaces for dropping expensive/intractible normalization constants.
Each density
-
$f(x, \theta)$ : a "kernel". This contains everything needed for certain methods, generalize those for which$\theta$ is fixed, e.g.$f$ can be used as a prior in MCMC if$\theta$ is fixed, and it can be a proposal/target in self-normalized importance sampling of$x$ . -
$g(\theta)$ : Generally a scaled integral over$f(x, \theta)$ . This is usually intractible, though for a select few named distributions it can be computed (sometimes expensively) using special functions. This is required whenever$\theta$ is not fixed, and for many distributions and inference methods it must be differentiable. -
$c$ is a constant factor dependent on the manifold and choice of measure (and its normalization convention). It's only needed if the method requires that the pdf be normalized to 1. The only method I can think of that would require this is importance sampling (not self-normalized).
In Distributions' own implementations, pdf
always computes the full pdf
,
In adhering to Distributions' own API, we can't assume what users will use pdf
/logpdf
for, so we would ideally return the full pdf
/logpdf
to specify which is computed, but we can't expect downstream packages to have support for those (e.g. Turing users never call logpdf
themselves).
Currently the best way I can think of to support this is either
- Every family gets a field that specifies its normalization.
- We by default just return the "kernel" and have a wrapper (e.g.
Normalized
) for any distribution that guarantees normalization constants are computed (or raises an error if not implemented).
(1) provides a nice terse syntax, while (2) increases code complexity.