Pymc3: Bug with pm.Forestplot

Created on 9 Aug 2018  路  3Comments  路  Source: pymc-devs/pymc3

If you have questions about a specific use case, or you are not sure whether this is a bug or not, please post it to our discourse channel: https://discourse.pymc.io

Description of your problem

While working on https://discourse.pymc.io/t/problems-with-hierachical-bayesian-model-advertising/1320/6 I came across a problem with forestplot.
Please provide a minimal, self-contained, and reproducible example.

pm.forest_plot(trace, varnames=['theta'])

Please provide the full traceback.

---------------------------------------------------------------------
ValueError                          Traceback (most recent call last)
<ipython-input-26-f6d543fc9676> in <module>()
----> 1 pm.forestplot(trace, varnames='thetas')

~/miniconda3/envs/stat-rethink-pymc3/lib/python3.6/site-packages/pymc3/plots/forestplot.py in forestplot(trace, models, varnames, transform, alpha, quartiles, rhat, main, xtitle, xlim, ylabels, colors, chain_spacing, vline, gs, plot_transformed, plot_kwargs)
    285         gr_plot.set_ylim(- var + 0.5, 0.5)
    286 
--> 287     plotrange = [np.min(all_quants), np.max(all_quants)]
    288     datarange = plotrange[1] - plotrange[0]
    289     interval_plot.set_xlim(plotrange[0] - 0.05 * datarange,

~/miniconda3/envs/stat-rethink-pymc3/lib/python3.6/site-packages/numpy/core/fromnumeric.py in amin(a, axis, out, keepdims)
   2418 
   2419     return _methods._amin(a, axis=axis,
-> 2420                           out=out, **kwargs)
   2421 
   2422 

~/miniconda3/envs/stat-rethink-pymc3/lib/python3.6/site-packages/numpy/core/_methods.py in _amin(a, axis, out, keepdims)
     27 
     28 def _amin(a, axis=None, out=None, keepdims=False):
---> 29     return umr_minimum(a, axis, None, out, keepdims)
     30 
     31 def _sum(a, axis=None, dtype=None, out=None, keepdims=False):

ValueError: zero-size array to reduction operation minimum which has no identity

Please provide any additional information below.

Versions and main components

I think everything is up to date. Latest version of PyMC3, however I saw the same bug with various versions of PyMC3.

I think there's some error in my model but perhaps we need better error handling for the forestplot.

defects

Most helpful comment

I can confirm that it works with arviz.

All 3 comments

I can recall speaking about this with @ColCarroll and I think that arviz might be a better solution.

I can confirm that it works with arviz.

Closing as this have been solved in ArviZ, and hopefully it will be deprecated here soon.

Was this page helpful?
0 / 5 - 0 ratings