Search code examples
pymcpymc3

Convinient way for transformations in pymc3


In certain cases pymc3 automatically performs variable transformations (see What are the interval transforms in pymc3 for uniform distributions?, what does the 'find_MAP' output mean in pymc3?).

In answer https://stackoverflow.com/a/42170938/5142797 I found which transformations are applied. So in principal I can perform backward and forward transformations now.

But is there a more convenient way to perform these forward and backward transformations on automatically transformed variables? That would be very convenient, e.g. for find_MAP results.


Solution

  • The following works:

    test_model = pymc3.Model()
    
    with test_model:
        u = pymc3.Uniform('u', 0, 1)
    
    test_model.u_interval__.distribution.transform_used.backward(0.5).eval()