How to save logp values during sampling?


#1

I asked a similar question here, but this time I’d like know if there’s a way to add the logp values of accepted points to the trace as we sample, so that we don’t have to evaluate it twice?


Frequently Asked Questions
#2

You are asking some great questions :wink: These should go into our docs I think…
There is two way to do it, the easiest is to create a Deterministic RV to save the logp. This is what we do in SMC currently:

A more complicated way is to put the logp into the sampler statistics of the trace, there is a discussion here:
https://github.com/pymc-devs/pymc3/pull/2339#pullrequestreview-45401866