11.16 Rethinking Code

ArviZ can also be used with PyStan results if it were to be easier. One of the main motivations for InferenceData is to create a standard format for all probabilistic programming languages, results are converted from PyMC3, PyStan, (Num)Pyro, TensorFlow Probability… to InferenceData so that ArviZ code can be backend agnostic. This allows to quickly support any library by adding only a converter function.

Option 1 is bound to be clunky unless you already have the data very well sorted :sweat_smile: (which is probably not the case in most real situations).

I tried to give it a go with xarray so that the result is the posterior dataset reshaped to have the correct dimensions for p which for me would be (actor, treatment, repetition). You can then average chain, draw, repetition dimensions to get the desired probabilities. I am not really sure I actually succeeded in reducing the clunkyness, I feel like it ended up increasing but still, I think the end result is quite interesting. I have updated the same notebook so I am not reposting the link.

2 Likes