So I seem to be unable to implement this with either method. I suppose that I must have big fundamental misunderstandings about what pymc is doing as it’s taken me several weeks to try to implement three models which would otherwise take an hour or so.
My problem is this: I don’t want CustomDist or model.register_rv to compute any logp function. I just want them to run the scan which stores mu and sigma values in tensors (e.g., T.set_subtensor(sigmaList[idx], sig,inplace=True), which I can then use after the scan to compute the likelihood of observations in pm.Normal(“likelihood”, mu=mus, sigma=sigmas, observed=observations).
If I try doing this using the CustomDist function then I am forced to pass the observations in at that point, such that I am not allowed to pass the observations into the likelihood function. model.register_rv also forces me to pass in observations, leading to the same problem, otherwise I still get the ‘random variable in logp graph’ error.
Is there some other function that will run the scan with a random variable in it, but will allow me to compute the likelihood function after the scan?