You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To fit the mathematical terminology more closely, and because of the ambiguities caused by transforming the graph in the function that builds the logprob graph, I suggest the following interface:
That would however not resolve all rewrite-related ambiguities and I will open a separate discussions on the rewrite interface.
Joint and conditional probabilities
One of AePPL’s core functionalities is to produce graphs that compute log-probabilities for Aesara graphs that contain RandomVariables. These graphs correspond to well-defined mathematical objects and it is important that the semantics in AePPL follows the definition of these objects closely.
If we let $\mathcal{G}$ be a probabilistic graphical model (PGM) over the variables $X_1, \dots, X_N$, we say that the joint distribution$P(X_1, \dots, X_N)$ factorizes according to $\mathcal{G}$ if $P$ can be expressed as the product:
In applications we are generally interested in computing the two quantities defined above: the joint probability $P(X_1=x_1, \dots, X_N=x_N)$ and the conditional probabilities $P(X_i=x_i| .)$. To compute the graph of the joint log-probability it is natural to define, following AePPL’s current syntax:
which returns a scalar. joint_factorized_logprob currently returns the conditional log-probabilities, and the following interface would follow the mathematical terminology more closely:
which returns a dictionary that maps x_vv and y_vv to the graph that compute the associated respecive conditional log-probabilities. Factorized logprob refers to a product and, without reading the documentation, one would expect joint_factorized_logprob to return a graph that represents the product of conditional log-probabilities.
The sum argument to joint_logprob should be removed and we only keep the behavior when sum=True.
Transformations
AePPL allows to specify transformations for the RandomVariables in a graph that are applied before constructing the logprob graph:
Many MCMC algorithms, and notoriously HMC, perform better when parameters are distributed on the real line. However the $\operatorname{C}^+$ distribution is defined on $\mathbb{R}^+$. To use HMC we would thus typically apply a log transformation to sigma_rv and condition on the result.
AePPL provides rewrite primitives that allow us to work in the transformed space without modifying our model. The goal is to be able to pass variables that take values in the transformed space to compute the model’s joint logprob, so outside callers need not be aware of the constraints on the support of the conditional distributions:
However this interface is ambiguous: we defined sigma_vv = sigma_rv.clone() in the original space, while after the transformation sigma_vv is supposed to take values in the transformed space. We can hide this ambiguity by having conditional_logprob clone and return the measurable variables:
althought we could make it work easily, I don't particularly like an interface where random variables and extra parameters can both be passed as keyword arguments. It is not a big improvement over the confusion we were trying to solve. As explained in #195 I think that the ambiguity of the current interface can only be resolved if we refactor the transforms interface. This should be the way forward once the name changes mentioned above are made.
enhancementNew feature or requestimportantThis label is used to indicate priority over things not given this labelrefactoringA change that improves the codebase but doesn't necessarily introduce a new feature
1 participant
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
TL;DR
To fit the mathematical terminology more closely, and because of the ambiguities caused by transforming the graph in the function that builds the logprob graph, I suggest the following interface:
That would however not resolve all rewrite-related ambiguities and I will open a separate discussions on the rewrite interface.
Joint and conditional probabilities
One of
AePPL
’s core functionalities is to produce graphs that compute log-probabilities for Aesara graphs that containRandomVariable
s. These graphs correspond to well-defined mathematical objects and it is important that the semantics inAePPL
follows the definition of these objects closely.If we let$\mathcal{G}$ be a probabilistic graphical model (PGM) over the variables $X_1, \dots, X_N$ , we say that the joint distribution $P(X_1, \dots, X_N)$ factorizes according to $\mathcal{G}$ if $P$ can be expressed as the product:
where$P(X_i|Pa_{X_i}^{\mathcal{G}})$ are conditional probability distributions, and $P_{X_i}^{\mathcal{G}}$ the parents of $X_i$ in $\mathcal{G}$ .
Aesara
we can be used to build (directed) PGMs by building a graph that containsRandomVariable
s:In applications we are generally interested in computing the two quantities defined above: the joint probability$P(X_1=x_1, \dots, X_N=x_N)$ and the conditional probabilities $P(X_i=x_i| .)$ . To compute the graph of the joint log-probability it is natural to define, following
AePPL
’s current syntax:which returns a scalar.
joint_factorized_logprob
currently returns the conditional log-probabilities, and the following interface would follow the mathematical terminology more closely:which returns a dictionary that maps
x_vv
andy_vv
to the graph that compute the associated respecive conditional log-probabilities. Factorized logprob refers to a product and, without reading the documentation, one would expectjoint_factorized_logprob
to return a graph that represents the product of conditional log-probabilities.The
sum
argument tojoint_logprob
should be removed and we only keep the behavior whensum=True
.Transformations
AePPL
allows to specify transformations for theRandomVariable
s in a graph that are applied before constructing the logprob graph:Many MCMC algorithms, and notoriously HMC, perform better when parameters are distributed on the real line. However the$\operatorname{C}^+$ distribution is defined on $\mathbb{R}^+$ . To use HMC we would thus typically apply a log transformation to
sigma_rv
and condition on the result.AePPL
provides rewrite primitives that allow us to work in the transformed space without modifying our model. The goal is to be able to pass variables that take values in the transformed space to compute the model’s joint logprob, so outside callers need not be aware of the constraints on the support of the conditional distributions:However this interface is ambiguous: we defined
sigma_vv = sigma_rv.clone()
in the original space, while after the transformationsigma_vv
is supposed to take values in the transformed space. We can hide this ambiguity by havingconditional_logprob
clone and return the measurable variables:We can always pass observations directly to
joint_logprob
using keyword arguments:althought we could make it work easily, I don't particularly like an interface where random variables and extra parameters can both be passed as keyword arguments. It is not a big improvement over the confusion we were trying to solve. As explained in #195 I think that the ambiguity of the current interface can only be resolved if we refactor the transforms interface. This should be the way forward once the name changes mentioned above are made.
Beta Was this translation helpful? Give feedback.
All reactions