Thank you for the prompt answer!
I’m not very familiar with the framework but Potential doesn’t allow to input observed values. Anyhow I’ve recycled you idea using DensityDist and I could make it work:
def weighted_logp(w,distributuion,**kwargs):
return distributuion.dist(**kwargs).logp
model = pm.Model()
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_w=pm.DensityDist('Y_w',weighted_logp(w,pm.Poisson,mu=mu) , observed=y)
trace=pm.sample(1000)
Thanks again!