Running a model on multiple datasets error

It appears to be the fact that you are trying to indexing into a tensor variable that is causing the problems. This example is sufficient to trigger the error.

with pm.Model() as model:
    pm_data = pm.Data('pm_data', [0,1,2,3])
    temp = pm_data['id']

I am not entirely sure what the intended behavior is when you pack a multidimensional structure into a pm.Data() container (e.g., it’s not obvious that the containerized data should provide an interface that matches the original, native data structure). But one potential solution is to break out the individual variables into separate pm.Data containers:

id = pm.Data('id', tmp_df['id'])
x = pm.Data('x', tmp_df['x'])
y = pm.Data('y', tmp_df['y'])
# etc.
2 Likes