transpose_to_model_dims#
- pymc_marketing.pytensor_utils.transpose_to_model_dims(posterior, model_dims, *, sample_dims=('chain', 'draw'))[source]#
Return
posteriorwith each variable’s dims in the order the model declares.PyMC’s posterior predictive reads a variable’s values in storage order against the dims its model declares, so a variable stored as
(channel, geo)for a model that declares(geo, channel)is read transposed, and silently so when the two axes have the same length. A variable whose non-sample dims are the declared dims in another order is transposed. Any other variable (one the model does not declare, or one over another set of dims) is left as given.- Parameters:
- Return type:
xr.Dataset- Returns:
posteriorwith every such variable in the model’s dim order, orposterioritself when every variable already is.