BayesianBLP.xi_as_grid#

BayesianBLP.xi_as_grid()[source]#

Reshape the posterior xi to (region, period, inside_product).

Post-hoc reshape of the flat (market,) posterior axis to a rectangular (region, period) grid. Cheap (just a numpy view) and only valid because _preprocess enforces lexicographic (region, period) ordering on markets when time_col is set.

Returns:
xr.DataArray with dims (chain, draw, region, period, inside_product).
Raises:
RuntimeError

If the model has not been fitted, or if time_col was not supplied at construction (no period coord exists).