Minibatch ADVI with Potential for Weighted Observations


In this example for using Minibatch with ADVI, it is emphasized that total_size needs to be set in order to properly calibrate the full likelihood. This is fine when the observable is a standard RandomVariable, which has observed and total_size parameters. However, it isn’t clear to me how this particular correction is to be done when using pm.Potential to weight observations.

For example, I have a gamma regression with weighted observations (weights W and observations Y), where I use

y = pm.Potential('y_logp_weighted', W*pm.Gamma.dist(mu=mu, sd=sigma).logp(Y))

Can anyone provide guidance for how to deal with this situation?