Wrapping a scipy distribution with DensityDist

I could be wrong, but I think odds needs to be passed into the logp as an argument. See this thread for more info. So something like this?

@as_op(itypes=[at.dvector, at.dscalar], otypes=[at.dvector])
def logp_(value, odds):
    return scipy.stats.nchypergeom_wallenius(140,
                                             80,
                                             60,
                                             odds=odds).logpmf(value)

odds = pm.Beta('odds', 1, 1)
y = pm.DensityDist("WNCH",
                   odds,
                   logp=logp_,
                   logcdf=logcdf_,
                   random=random_,
                   observed=data)                 
3 Likes