Hierarchical Model with Black Box Loglikelihood

I don’t actually need to do that for this case. To test the model, I’m simulating data, and in the normal case, each of the individual as_tensor_variable callouts would have slightly different parameters. To simplify testing for the hierarchical version, I made them all the same, but never removed the extra callouts.

An additional question on top of this. Say I want to do this with 50 datasets. Thus, I would need 50 pm.Potential callouts. This becomes too time consuming to hard code, especially if I want a variable amount of data sets. I know that looping isn’t a great idea within aesara/pytensor, so can I use scan to replace it instead? What is the best way to go about replacing a loop of this kind:

for ii in range(50):
     pm.Potential('llh' + str(ii), logl(phi[ii]))
end