You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to reproduce the code used in the AR(2) example. The sampling is normal but I receive a ValueError when i try to use pm.traceplot. I think that this issue is related to the way arviz handles MultiTrace.
Description of your problem
Please provide a minimal, self-contained, and reproducible example.
<ipython-input-4-dc52240121b7>in<module>()
---->1pm.traceplot(trace)
*/python3.6/site-packages/pymc3/plots/__init__.pyinwrapped(*args, **kwargs)
40warnings.warn('Keyword argument `{old}` renamed to `{new}`, and will be removed in pymc3 3.8'.format(old=old, new=new))
41kwargs[new] =kwargs.pop(old)
--->42returnfunc(*args, **kwargs)
43returnwrapped44*/python3.6/site-packages/arviz/plots/traceplot.pyinplot_trace(data, var_names, coords, divergences, figsize, textsize, lines, combined, plot_kwargs, fill_kwargs, rug_kwargs, hist_kwargs, trace_kwargs)
102divergences=False103-->104data=convert_to_dataset(data, group="posterior")
105var_names=_var_names(var_names, data)
106*/python3.6/site-packages/arviz/data/converters.pyinconvert_to_dataset(obj, group, coords, dims)
156xarray.Dataset157-->158inference_data=convert_to_inference_data(obj, group=group, coords=coords, dims=dims)
159dataset=getattr(inference_data, group, None)
160ifdatasetisNone:
*/python3.6/site-packages/arviz/data/converters.pyinconvert_to_inference_data(obj, group, coords, dims, **kwargs)
80returnfrom_pystan(**kwargs)
81elifobj.__class__.__name__=="MultiTrace": # ugly, but doesn't make PyMC3 a requirement--->82returnfrom_pymc3(trace=kwargs.pop(group), **kwargs)
83elifobj.__class__.__name__=="EnsembleSampler": # ugly, but doesn't make emcee a requirement84returnfrom_emcee(sampler=kwargs.pop(group), **kwargs)
*/python3.6/site-packages/arviz/data/io_pymc3.pyinfrom_pymc3(trace, prior, posterior_predictive, coords, dims)
150posterior_predictive=posterior_predictive,
151coords=coords,
-->152dims=dims,
153 ).to_inference_data()
*/python3.6/site-packages/arviz/data/io_pymc3.pyinto_inference_data(self)
135**{
136"posterior": self.posterior_to_xarray(),
-->137"sample_stats": self.sample_stats_to_xarray(),
138"posterior_predictive": self.posterior_predictive_to_xarray(),
139"prior": self.prior_to_xarray(),
*/python3.6/site-packages/arviz/data/base.pyinwrapped(cls, *args, **kwargs)
23ifgetattr(cls, prop) isNone:
24returnNone--->25returnfunc(cls, *args, **kwargs)
2627returnwrapped*/python3.6/site-packages/arviz/data/io_pymc3.pyinsample_stats_to_xarray(self)
76name=rename_key.get(stat, stat)
77data[name] =np.array(self.trace.get_sampler_stats(stat, combine=False))
--->78log_likelihood, dims=self._extract_log_likelihood()
79iflog_likelihoodisnotNone:
80data["log_likelihood"] =log_likelihood*/python3.6/site-packages/arviz/data/base.pyinwrapped(cls, *args, **kwargs)
23ifgetattr(cls, prop) isNone:
24returnNone--->25returnfunc(cls, *args, **kwargs)
2627returnwrapped*/python3.6/site-packages/arviz/data/io_pymc3.pyin_extract_log_likelihood(self)
54forchaininself.trace.chains:
55log_like= (log_likelihood_vals_point(point) forpointinself.trace.points([chain]))
--->56chain_likelihoods.append(np.stack(log_like))
57returnnp.stack(chain_likelihoods), coord_name58*/python3.6/site-packages/numpy/core/shape_base.pyinstack(arrays, axis, out)
408""" 409 _warn_for_nonsequence(arrays)--> 410 arrays = [asanyarray(arr) for arr in arrays] 411 if not arrays: 412 raise ValueError('need at least one array to stack')*/python3.6/site-packages/numpy/core/shape_base.py in <listcomp>(.0) 408 """409_warn_for_nonsequence(arrays)
-->410arrays= [asanyarray(arr) forarrinarrays]
411ifnotarrays:
412raiseValueError('need at least one array to stack')
*/python3.6/site-packages/arviz/data/io_pymc3.pyin<genexpr>(.0)
53chain_likelihoods= []
54forchaininself.trace.chains:
--->55log_like= (log_likelihood_vals_point(point) forpointinself.trace.points([chain]))
56chain_likelihoods.append(np.stack(log_like))
57returnnp.stack(chain_likelihoods), coord_name*/python3.6/site-packages/arviz/data/io_pymc3.pyinlog_likelihood_vals_point(point)
49log_like_val=log_like_val[~var.observations.mask]
50log_like_vals.append(log_like_val)
--->51returnnp.concatenate(log_like_vals)
5253chain_likelihoods= []
ValueError: zero-dimensionalarrayscannotbeconcatenated
Please provide any additional information below.
This problem doesn't depend on the numpy version (even if i get a FutureWarning on the behavior of concatenation). I'm using numpy 1.16.4, but i still have the issue with older version of numpy.
This problem also happens in the AR(1) case, when i use shape = 1 .
Versions and main components
PyMC3 Version: 3.7
Theano Version: 1.0.4
Python Version: 3.6.1
Arviz Version : 0.4.0
Operating system: Debian 3.16.43
How did you install PyMC3: pip
The text was updated successfully, but these errors were encountered:
I'm trying to reproduce the code used in the AR(2) example. The sampling is normal but I receive a ValueError when i try to use pm.traceplot. I think that this issue is related to the way arviz handles MultiTrace.
Description of your problem
Please provide a minimal, self-contained, and reproducible example.
Please provide the full traceback.
Please provide any additional information below.
This problem doesn't depend on the numpy version (even if i get a FutureWarning on the behavior of concatenation). I'm using numpy 1.16.4, but i still have the issue with older version of numpy.
This problem also happens in the AR(1) case, when i use shape = 1 .
Versions and main components
The text was updated successfully, but these errors were encountered: