我注意到在 pymc3 中使用均匀分布时,采样器还会扫描 _interval
参数也是如此,除非指定了转换,例如:
with fitModel6:
normMu = pm.Uniform('normMu',lower=0,upper=1000)
不仅会导致对 normMu 进行采样,还会导致对 normMu_interval 进行采样:
trace plot of interval
trace plot of parameter
通常,当我使用统一先验作为尺度参数(如归一化)时,我当然会在对数间隔内进行采样。 pymc3 是否以某种方式为我处理这个问题?
干杯
最佳答案
PyMC3 自动将转换应用于有界变量,以将它们置于不受约束的范围内。每个转换的代码是 here并且在官方 PyMC3 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__
representsx
transformed to accept parameter values between -inf and +inf. In the case of an upper and a lower bound, aLogOdd
s transform is applied. Sampling in this transformed space makes it easier for the sampler...
关于bayesian - pymc3 中均匀分布的区间变换是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34577875/