How to transform a 'dist' object?

I’m building a Mixture, so I’m using ‘dist’ object (not classic RV), and I need to transform this variable, before using it in the mixture…

The transformation leads to an error, since the ‘dist’ object is not a classic RV…

This is a minimal code showing the problem (the problem arise before the mixture so I don’t need to show it here):

import pymc3 as pm

with pm.Model() as model:
    n = pm.Normal.dist(mu=0,sd=1)
    n = pm.math.log(n)

This produce an error at the log function call :

AsTensorError: ('Cannot convert <pymc3.distributions.continuous.Normal object at 0x7f105fd2c198> to TensorType', <class 'pymc3.distributions.continuous.Normal'>)

How can I apply the transformation this kind of transformation to a ‘dist’ object ?

Any Idea or suggestion will be appreciated.

1 Like