Understanding 'Coords' and 'dims' to analyze dataset

PyMC broadcasts just like numpy broadcasts. So if we had a parameter with shape (4,):

dummy_param = np.array([42, 21, 37, 59])

and we index into dummy_param with our idx variable defined in the code snippet above (which is shape (8,)):

dummy_param[idx]

then we get a result which is shape (8,), where each value is the corresponding value from dummy_param indicated by idx:

array([42, 42, 21, 21, 37, 37, 59, 59])

The idea is that PyMC should require no additional knowledge about broadcasting if you already understand how numpy works.

1 Like