Marginal log-likelihood using blackbox likelihood function


Is there a way to obtain or calculate the marginal log likelihood when using a blackbox likelihood function?
I was able to get the element wise log likelihood for WAIC model comparision using a custom distribution with a logp function, but would also like to calculate the bayes factor between my models.

I am using SMC sampling pm.smc.sample_smc. Is there is a way to get the importance weights from the SMC sampling, that way I can multiply the log likelihood with the prior weights?

You can use a CustomDist to implement your black box likelihood. We are actually rewriting the PyMC example to use CustomDist instead of a Potential: Update blackbox likelihood example by ricardoV94 · Pull Request #631 · pymc-devs/pymc-examples · GitHub