What are the interval transforms in pymc3 for uniform distributions?

喜夏-厌秋 提交于 2019-12-07 09:38:06

问题


I've noticed that when using uniform distributions in pymc3, the sampler also scans over an _interval parameter as well unless a transform is specified for example:

with fitModel6:

    normMu  = pm.Uniform('normMu',lower=0,upper=1000)

will result in not only sampling over normMu, but also, normMu_interval:

trace plot of interval

trace plot of parameter

Normally, when I am using an uniform prior for scale parameter like a normalization, I will of course sample over the log interval. Is pymc3 handling this for me somehow?

Cheers


回答1:


PyMC3 automatically applies transformations to bounded variables to put them on an unconstrained scale. The code for each transformation is here and a very brief discussion of the automatic transformation of variables is found in the official PyMC3 Tutorial.

Edit

In case the link breaks/moves again, here's the bulk of the info from the Tutorial

In order to sample models more efficiently, PyMC3 automatically transforms bounded RVs to be unbounded.

with pm.Model() as model:
    x = pm.Uniform('x', lower=0, upper=1)`

When we look at the RVs of the model, we would expect to find x there, however:

In [16]: model.free_RVs

Out[16]: [x_interval__]

x_interval__ represents x transformed to accept parameter values between -inf and +inf. In the case of an upper and a lower bound, a LogOdds transform is applied. Sampling in this transformed space makes it easier for the sampler...



来源:https://stackoverflow.com/questions/34577875/what-are-the-interval-transforms-in-pymc3-for-uniform-distributions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!