Arviz KDE always results in FloatingPointError: underflow encountered in exp

Welcome!

I suspect that the bw="scott" should be passed in as hist_kwargs rather than plot_kwargs.

The default is to throw out warmup/tuning samples, so if you request “4 samples” (e.g., `idata=pm.sample(4)) you are most likely getting 4 draws that occur after the (default 1000) tuning samples.

The other obvious way to investigate would be to dive into the inference data itself. Once you figure out what’s going on, then maybe you get things working with ArviZ. @OriolAbril suggested this as a potential shortcut to get just the trace (and not the KDE):

plotters = list(az.sel_utils.xarray_var_iter(data.posterior, combined=True, dim_order=["draw", "chain"]))
n_plots = len(plotters)
fig, axes = plt.subplots(n_plots//3, 3) # or variations
for ax, (var_name, sel, isel, var_data) in zip(axes.ravel(), plotters):
    ax.plot(var_data, lw=1, alpha=.5)
    ax.set_title(var_name)
plt.show()
1 Like