我正在使用pymc3(具有大量先验的图形模型)进行贝叶斯分析,如下所示:
import pymc3 as pm
import theano.tensor as T
with pm.Model() as smk:
a_u = pm.InverseGamma('a_u',alpha=2*np.ones(L),beta=1/A_u**2,shape=L)
sigma2_u =
pm.InverseGamma('sigma2_u',alpha=2*np.ones(L),beta=1/a_u,shape=L)
a_eps = pm.InverseGamma('a_eps',alpha=2,beta=1/A_eps**2)
sigma2_eps = pm.InverseGamma('sigma2_eps',alpha=2,beta=1/a_eps)
a_R = pm.InverseGamma('a_R',alpha=2,beta=1/A_R**2,shape=q)
Sigma_R_inv = pm.distributions.multivariate.Wishart('Sigma_R_inv',nu=v+q-1,V=1/(2*v)*T.nlinalg.AllocDiag(a_R))
Sigma_R = T.nlinalg.MatrixInverse(Sigma_R_inv)
u_R = pm.distributions.multivariate.MvNormal('u_R',np.zeros(m*q),T.slinalg.kron(np.eye(m),Sigma_R))
u_G = pm.distributions.multivariate.MvNormal('u_G',np.zeros(L),T.nlinalg.AllocDiag(sigma2_u))
beta = pm.Normal('beta',mu=0,sd=sigma_beta,shape=p)
y = pm.Normal('y',mu = T.dot(X,beta)+T.dot(Z_R,u_R)+T.dot(Z_G,u_G),sd=sigma_eps,observed=Y)
with smk:
trace= pm.sample(10000)
然后报告错误," TypeError:object()不带参数"在这一行,
Sigma_R_inv = pm.distributions.multivariate.Wishart('Sigma_R_inv',nu=v+q-1,V=1/(2*v)*T.nlinalg.AllocDiag(a_R))
我想知道为什么,有人可以帮助我,谢谢!