Replies: 1 comment 1 reply
-
Condition on a sequence of transforms of a single random variableIt is in theory straightforward to condition on a sequence of transfomations of a single import aesara
import aesara.tensor as at
srng = at.random.RandomStream(0)
x_rv = srng.normal(0, 1)
y = at.pow(at.log(x_rv), 2)
aesara.dprint(y)
# Elemwise{pow,no_inplace} [id A]
# |Elemwise{log,no_inplace} [id B]
# | |normal_rv{0, (0, 0), floatX, False}.1 [id C]
# | |RandomGeneratorSharedVariable(<Generator(PCG64) at 0x7FE5D837A880>) [id D]
# | |TensorConstant{[]} [id E]
# | |TensorConstant{11} [id F]
# | |TensorConstant{0} [id G]
# | |TensorConstant{1} [id H]
# |TensorConstant{2} [id I] First, we need to provide y_vv = y.clone()
x_vv = at.exp(at.sqrt(y_vv)) To compute the probability # P(y=y_vv)
logprob_y = log_det_jac_exp + log_det_jac_pow + _logprob(x_rv.op, x_vv) Should we use Aesara
|
Beta Was this translation helpful? Give feedback.
-
TL;DR
I think we should remove the bijections from the
extra_rewrites
interface and move the automation to AeMCMC. This requires pushing for #78 or similar to allow conditioning on transformations ofRandomVariable
s every time it is mathematically well-defined.The interface for transforms is ambiguous
Let us consider the following model, where the$\mathcal{C}^+$ distribution is defined on $\mathbb{R}^+$ :
Some samplers (for instance HMC) work better with variables that can take values in$\mathbb{R}$ .
AePPL
proposes the following interface to allow to work in the transformed space with the above model:As discussed in #193 this interface is ambiguous: while$\mathbb{R}^+$ , it now takes values in $\mathbb{R}$ .
sigma_vv
is associated withsigma_rv
with supportThe interface for transforms is redundant
We could achieve the same result as the previous code snippet with the following:
The code is much shorter, the interface is not ambiguous. Why would we make callers remember the existence of
TransformValuesRewrite
andLogTransform
when they already know aboutat.log
? The current interface to apply these bijection transforms is not only confusing, it is completely redundant.The above example currently does not work, for the reasons given in #119. This kind of conditioning should however be supported, independently from the above considerations. If anything, being able to clean the rewrite interface should give us extra motivation to move forward with e.g. #78.
DEFAULT_TRANSFORM
is sampler-specificAePPL does provide a utility for callers who do not know what transform should be applied; one would replace
LogTransform
withDEFAULT_TRANSFORM
in the code above. However, this automation is sampler-specific and naturally belongs to AeMCMC.Related to #142
Recommandations
I believe we should move the bijections out of the
extra_rewrites
interface, move the automation to AeMCMC and focus instead in AePPL on making conditioning on graphs with measurable transformations better, e.g. by working on #78.Note that the only thing that would be removed is automation. The need to pass these rewrites to
joint_logprob
is already served in a much better way by defining transformed variables with AesaraOp
s directly.Beta Was this translation helpful? Give feedback.
All reactions