Hi, this might be a bit of a silly question but I’m using Turing to run a Bayesian MCMC algorithm. I’m using a distribution I made up as the distribution of my response variable and I would like the chain object to store the values of the PDF from this distribution. The reason for this is that the PDF takes a long time to compute so I don’t like having to compute it after the algorithm is done, since I’m effectively doing the same computation twice. Any thoughts for a workaround on this? Right now, this is what I have:
@model function turing_model(x)
α ~ Uniform(-5.0, 5.0)
β ~ Uniform(-5.0, 5.0)
γ ~ Uniform(-5.0, 5.0)
q ~ Uniform(-5.0, 5.0)
x ~ CustomDist(α, β, γ, q)
end
Somewhere in there, is there a place I could record the likelihood function values for each value of the parameters? I know how to access the parameter values of each iteration from the output of the sample
function, but it doesn’t seem to keep track of the likelihoods. Thoughts?