How to perform weighted inference

If you want to scale the logp of the observed the same way as Bob’s solution in stackoverflow, the easiest way is to use a potential:

with model:

    b0=pm.Normal('b0',mu=0,sd=.1)
    b1=pm.Normal('b1',mu=0,sd=.1)
    mu=pm.math.exp(b0*X[:,0]+b1*X[:,1])
    y_=pm.Potential('Y_obs',w*pm.Poisson.dist(mu=mu).logp(y))
1 Like