I’ve been taking a look at @sethaxen 's work and it looks amazing (on behalf of Bayesians everywhere: thank you Seth! )
I see that ArviZ does indeed wrap some of the functions I was thinking of (waic()
and loo()
for example) It seems that I am missing a step.
when I follow the example from the ArviZ readme, and then try to run waic(data)
I get an error saying there is no log likelihood:
using ArviZ, PyPlot, Turing
ArviZ.use_style(["default", "arviz-darkgrid"])
# Turing model
@model school8(J, y, sigma) = begin
mu ~ Normal(0, 5)
tau ~ Truncated(Cauchy(0, 5), 0, Inf)
theta ~ Normal(mu, tau)
for j = 1:J
y[j] ~ Normal(theta, sigma[j])
end
end
J = 8
y = [28.0, 8.0, -3.0, 7.0, -1.0, 1.0, 18.0, 12.0]
sigma = [15.0, 10.0, 16.0, 11.0, 9.0, 11.0, 10.0, 18.0]
model_fun = school8(J, y, sigma)
sampler = NUTS(0.8)
chn = mapreduce(c -> sample(model_fun, sampler, 1000), chainscat, 1:4) # 4 chains
data = convert_to_inference_data(chn) # convert MCMCChains.Chains to InferenceData
summary(data) # show summary statistics
waic(data)
loo(data)
specifically the error says data must include log_likelihood in sample_stats
.
I’d really appreciate any advice!