DensityDist in PyMC4

Are custom likelihoods implemented in PyMC4? I didn’t see a DensityDist method. I was able to define and compute the likelihood as a tensor function but it is unattached and doesn’t affect sampling.

Not yet. Currently, the way to do this is to write down your log prob function, call it within a pm.model and wrap the resulting tensor with a potential like this:

@pm.model()
def model():
    # something
    yield pm.Potential(your_log_prob_function(*args, **kwargs))
3 Likes

Thanks alot. That worked.