I have some code which runs a Bayesian model.
As output I get samples from a posterior distribution in numpy arrays.
Is it possible to load these numpy.arrays to pymc3 so that I could get the HPD intervals, visualize traceplots, ACFs, obtain other summary statistics as it would be possible if the model were conducted through pymc3?
I am new to pymc3. Didn’t know. Thank you!
You can also try Arviz, our next generation plotting library that developing towards the support for pymc3, pystan, pyro, etc. In the future we will actually deprecate plotting in pymc3 and call Arviz directly.
I hope I’m not offending anyone, but it seems that things with Arviz aren’t moving as fast as desired.
As a suggestion: would you consider a collaboration with the guys from
plot.ly? I think both would benefit from the synergy.
They are doing some really nice stuff there. Now they are building
plotly_express — a high-level wrapper around plotly.py.
I think it might be more constructive if you can list some of the areas you think Arviz is not moving fast enough.
On the topic of plotly, as a big user of Dash (which is powered by the former), I would say Arviz is most definitely the better choice, merely for the reason (though not the only one) that it is based on matplotlib, which is superior in its flexibility as compared to plotly.
Where plotly excels is in creating highly interactive, and efficient, graphs on the web, whereas Pymc3 just needs a fuller complement of visualizations in general; so, for now, plotly should be kept in mind for future versions of Pymc when “web-hostable” graphics will be desired.
(note: I spend a lot of time working on arviz, and just had a lot of coffee)
I would be super excited to port a lot of the arviz plotting to altair, but right now:
- there is not great xarray support for altair (but they aren’t against such support)
- right now altair embeds your data as json in the DOM in notebooks. arviz crashes your computer if you accidentally plot more than like, 100 dimensions of data (which is fairly typical) because of too many axes. arviz on altair with more than, like 100,000 samples (which is super typical) will crash your browser and then maybe your computer.
xarray support would mean the data could live safely on disk, instead of crashing everything you hold dear.
There is also interest in working with
bokeh or something like
datashader (which seem like good ideas, I just really like writing altair code!) Dash also seems like an exciting project - plotting samples is a pretty funny use case for most libraries, in that you want to plot a lot of modestly shaded or smoothed data, and often want to drill into particular categories or dimensions.
In terms of immediate performance for matplotlib, we could implement
Artists ourselves, and do as much calculation on the machine as we can before rendering. This might be a good solution if there is call for really big pair plots or something. I get pretty frustrated at the lack of interaction, and I guess that’s a tradeoff we have to make for now.