WAIC, or LOO etc in Turing?

For LOO and WAIC to work, you need to save the log likelihood values of your individual samples. I don’t know Turing, but in Stan you would put something like this in the generated quantities block:

vector[J] log_likelihood;
for (j in 1:J) {
    log_likelihood[j] = normal_lpdf(y[j] | theta, sigma[j]);
}

I would also suggest using LOO instead of WAIC as it has better diagnostics.

2 Likes