问题描述
我注意到,当在pymc3中使用均匀分布时,采样器还会扫描_interval
参数,除非指定了转换,例如:
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)
不仅会导致对normMu进行采样,还会导致normMu_interval:
will result in not only sampling over normMu, but also, normMu_interval:
通常,当我对尺度参数(如归一化)使用统一的先验时,我当然会在对数间隔内进行采样. pymc3是否以某种方式为我处理此问题?
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?
欢呼
推荐答案
PyMC3自动将转换应用于有界变量,以使其不受约束. 此处和在官方PyMC3 教程.
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.
修改
万一链接再次断开/移动,这是教程中的大部分信息
In case the link breaks/moves again, here's the bulk of the info from the Tutorial
with pm.Model() as model:
x = pm.Uniform('x', lower=0, upper=1)`
当我们查看模型的RV时,我们希望在那里找到x
,
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__
表示x
,已转换为接受-inf和+ inf之间的参数值.在上限和下限的情况下,将应用LogOdd
s变换.在这个变换后的空间中采样使采样器更容易...
x_interval__
represents x
transformed to accept parameter values between -inf and +inf. In the case of an upper and a lower bound, a LogOdd
s transform is applied. Sampling in this transformed space makes it easier for the sampler...
这篇关于pymc3中用于均匀分布的区间转换是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!