问题
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