Arviz: add example about transforming and/or creating variables

Created on 12 Apr 2019  路  6Comments  路  Source: arviz-devs/arviz

We should have at least one example about modifying, transforming and/or creating a variable before plotting, something like

data.posterior['log_temperature'] = np.log(data.posterior.temperature)

data.posterior['diff_temperature'] = data.posterior.temperature1 - data.posterior.temperature2

Beginner User Documentation

Most helpful comment

Hi, sounds great

Maybe a new notebook? e.g. "Working with the InferenceData" or something similar?

All 6 comments

@aloctavodia I'll add an example in the xarray section of tutorial in the meanwhile

Hey, I recently went through a few xarray tutorials to understand how to best modify and transform my posterior, so I would love to take this issue on to make it easier for the next one.
I can write something transformations such as @aloctavodia mentioned above, but also how to stack dimensions, group by dimension + aggregate, e.g. mean/median per group.

Where would be a good start for this? Just extend the section about inference data? Or the cookbook? Or better a new tutorial/notebook?

Hi, sounds great

Maybe a new notebook? e.g. "Working with the InferenceData" or something similar?

Okay good, will do :)

From a conversation in slack and wanted to suggest using idata.posterior = idata.posterior.assign(...) also, in addition to idata.posterior["new_var"] = ..., as assign allows to add multiple variables at the same time. Moreover, it could also be interesting to add some examples on using idata.map to transform variables in several groups at the same time and add them to the corresponding group.

Closing in favour of #1486

Was this page helpful?
0 / 5 - 0 ratings