pymc3 generate stochastic variables with array of parameters

半世苍凉 提交于 2019-12-11 08:03:26

问题


In pymc3, a stochastic variable of array shape say 3 can be generated as follows

y = Normal('y', mu, sigma, shape=3, observed=some_data)

Now suppose that y depends on an array of parameters mu = [1,2,3] and sigma = [4,5,6] instead of single values, how would I specify it?


回答1:


I wanted a way to do the something like following

for i in range(3):
    y[i] = Normal(mu[i], sigma[i], observed=somedata[i]) 

The way to do it is to simply pass in a list of values.

y=Normal(mu, sigma, observed=somedata) 

where mu and sigma are lists



来源:https://stackoverflow.com/questions/37019724/pymc3-generate-stochastic-variables-with-array-of-parameters

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