# aeppl.factorized_joint_logprob#

aeppl.factorized_joint_logprob(rv_values, warn_missing_rvs=True, ir_rewriter=None, extra_rewrites=None, **kwargs)[source]#

Create a map between variables and their log-probabilities such that the sum is their joint log-probability.

The rv_values dictionary specifies a joint probability graph defined by pairs of random variables and respective measure-space input parameters

For example, consider the following

import aesara.tensor as at

sigma2_rv = at.random.invgamma(0.5, 0.5)
Y_rv = at.random.normal(0, at.sqrt(sigma2_rv))


This graph for Y_rv is equivalent to the following hierarchical model:

$\begin{split}\sigma^2 \sim& \operatorname{InvGamma}(0.5, 0.5) \\ Y \sim& \operatorname{N}(0, \sigma^2)\end{split}$

If we create a value variable for Y_rv, i.e. y_vv = at.scalar("y"), the graph of factorized_joint_logprob({Y_rv: y_vv}) is equivalent to the conditional probability $$\log p(Y = y \mid \sigma^2)$$, with a stochastic sigma2_rv. If we specify a value variable for sigma2_rv, i.e. s_vv = at.scalar("s2"), then factorized_joint_logprob({Y_rv: y_vv, sigma2_rv: s_vv}) yields the joint log-probability of the two variables.

$\log p(Y = y, \sigma^2 = s) = \log p(Y = y \mid \sigma^2 = s) + \log p(\sigma^2 = s)$
Parameters
• rv_values (Dict[TensorVariable, TensorVariable]) – A dict of variables that maps stochastic elements (e.g. RandomVariables) to symbolic Variables representing their values in a log-probability.

• warn_missing_rvs (bool) – When True, issue a warning when a RandomVariable is found in the graph and doesn’t have a corresponding value variable specified in rv_values.

• ir_rewriter (Optional[GraphRewriter]) – Rewriter that produces the intermediate representation of Measurable Variables.

• extra_rewrites (Union[GraphRewriter, NodeRewriter, None]) – Extra rewrites to be applied (e.g. reparameterizations, transforms, etc.)

Return type

Dict[TensorVariable, TensorVariable]

Returns

• A dict that maps each value variable to the log-probability factor derived

• from the respective RandomVariable.