Hi Pymc3 community,
I am getting the following error when running traceplot. I think this may be a bug because the trace looks fine to me. Code and output is below, a pickled model/trace object here [because discourse doesnt allow the upload of a .pkl file… sigh].
Thanks!
def run_pooled_model(data):
with pm.Model() as pooled_model:
mu_intr = pm.Normal('mu_intr', mu=0.8, sd=100 ** 2)
mu_tst = pm.Normal('mu_tst', mu=0.0, sd=100 ** 2)
mu_age = pm.Normal('mu_age', mu=0.0, sd=100 ** 2)
mu_sex = pm.Normal('mu_sex', mu=0.0, sd=100 ** 2)
mu_age_sex = pm.Normal('mu_age_sex', mu=0.0, sd=100 ** 2)
mu_starttime = pm.Normal('mu_starttime', mu=0.0, sd=100 ** 2)
# Model error
model_err = pm.HalfNormal('model_err', sd=0.1)
# Expected value
y_est = pm.math.invlogit(mu_intr + \
mu_tst * data['tst'] + \
mu_age * data['age'] + \
mu_sex * data['sex'] + \
mu_starttime * data['starttime'] + \
mu_age_sex * data['age'] * data['sex'])
# Data likelihood
y_like = pm.Beta('y_like', mu=y_est, sd=model_err, observed=data["sleepefficiency"])
with pooled_model:
pooled_trace = pm.sample(2000)
pm.traceplot(pooled_trace[-1000:])
Auto-assigning NUTS sampler…
Initializing NUTS using advi…
Average ELBO = -inf: 100%|██████████| 200000/200000 [09:26<00:00, 352.93it/s]
Finished [100%]: Average ELBO = -inf
98%|█████████▊| 1970/2000 [00:08<00:00, 209.08it/s]100%|█████████▉| 1991/2000 [00:09<00:00, 209.33it/s]100%|██████████| 2000/2000 [00:09<00:00, 220.18it/s]
Traceback (most recent call last):
File “C:\Program Files\JetBrains\PyCharm 2017.1.2\helpers\pydev\pydevd.py”, line 1585, in
globals = debugger.run(setup[‘file’], None, None, is_module)
File “C:\Program Files\JetBrains\PyCharm 2017.1.2\helpers\pydev\pydevd.py”, line 1015, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File “C:\Program Files\JetBrains\PyCharm 2017.1.2\helpers\pydev_pydev_imps_pydev_execfile.py”, line 18, in execfile
exec(compile(contents+“\n”, file, ‘exec’), glob, loc)
File “C:/Users/bdyet/GoogleDrive/NapArch/DiscreteBayes/MultiLevelModeling/main.py”, line 144, in
pm.traceplot(pooled_trace[-1000:])
File “C:\Users\bdyet\Anaconda3\lib\site-packages\pymc3\plots.py”, line 91, in traceplot
kdeplot_op(ax[i, 0], d, prior, prior_alpha, prior_style)
File “C:\Users\bdyet\Anaconda3\lib\site-packages\pymc3\plots.py”, line 126, in kdeplot_op
density, l, u = fast_kde(d)
File “C:\Users\bdyet\Anaconda3\lib\site-packages\pymc3\plots.py”, line 835, in fast_kde
grid = convolve(grid, kernel, mode=‘same’)[npad: npad + nx]
File “C:\Users\bdyet\Anaconda3\lib\site-packages\scipy\signal\signaltools.py”, line 783, in convolve
method = choose_conv_method(volume, kernel, mode=mode)
File “C:\Users\bdyet\Anaconda3\lib\site-packages\scipy\signal\signaltools.py”, line 673, in choose_conv_method
max_value = int(np.abs(volume).max()) * int(np.abs(kernel).max())
File “C:\Users\bdyet\Anaconda3\lib\site-packages\numpy\core_methods.py”, line 26, in _amax
return umr_maximum(a, axis, None, out, keepdims)
ValueError: zero-size array to reduction operation maximum which has no identity