Hello,
when I sample, the sampling process will stop and go wrong,and I don’t know where the error is,I hope I can get some help and advice,Here’s my code:
time_obseved = [-4.0, -1.0, 0.0, 1.5, 2.0]
time = np.array(time_obseved)
H0 = np.zeros((n, n))
for i in range(0, n):
for j in range(0, n):
H0[i, j] = np.abs(time[j] - time[i])
with pm.Model() as model:
sigma_w = pm.Uniform('sigma_w', 0.0, 2.0)
rho = pm.Uniform('rho', 0.0, 0.9)
omega = pm.MvNormal('omega',mu=mu0,cov=sigma_w**2 * tt.pow(rho, H0),shape=(1,n))
mu=pm.Normal('mu',mu=0.0,sd=1.0)
xi=pm.InverseGamma('xi',2.0,1.0)
b = pm.Normal('b', mu=0.0, sd=tt.sqrt(xi), shape=(N, 1))
mu2 = (mu + b) * e + omega
sigma=pm.Normal('sigma',1.0,0.5)
y = pm.Normal(
'y', mu=mu2, sd=sigma,
observed=dataSet1)
with model:
trace=pm.sample(5000,njobs=1)
pm.traceplot(trace)
The following error occurred in the runtime:
ZeroDivisionError: 0.0 cannot be raised to a negative power
Apply node that caused the error: Elemwise{Composite{(i0 * i1 * i2 * (i3 ** i4))}}[(0, 0)](Elemwise{Composite{Switch(i0, (((i1 + i2) * i3) - i4), i5)}}[(0, 3)].0, Elemwise{Sqr}[(0, 0)].0, TensorConstant{[[0. 3. .. 0.5 0. ]]}, InplaceDimShuffle{x,x}.0, TensorConstant{[[-1. 2...0.5 -1. ]]})
Toposort index: 150
Inputs types: [TensorType(float64, matrix), TensorType(float64, (True, True)), TensorType(float64, matrix), TensorType(float64, (True, True)), TensorType(float64, matrix)]
Inputs shapes: [(5, 5), (1, 1), (5, 5), (1, 1), (5, 5)]
Inputs strides: [(40, 8), (8, 8), (40, 8), (8, 8), (40, 8)]
Inputs values: ['not shown', array([[3.99999782]]), 'not shown', array([[0.]]), 'not shown']
Outputs clients: [[Sum{acc_dtype=float64}(Elemwise{Composite{(i0 * i1 * i2 * (i3 ** i4))}}[(0, 0)].0)]]