-
Notifications
You must be signed in to change notification settings - Fork 228
Closed
Description
Apparently Turing now has a built-in predict function, which is great. Unfortunately, when I run it on a prior-sampled chains object (to do a prior predictive check), it seems to return no predictions:
using Turing
using DataFrames
# Regression model example
@model function lm(y, x)
# Priors
σ² ~ InverseGamma(2, 3) # Sigma
intercept ~ Normal(0, sqrt(3)) # Intercept
β ~ TDist(3)
# Calculate all the mu terms.
mu = intercept .+ x * β
# Likelihood
return y ~ Normal(mu, σ²)
end
chain = sample(lm(0, 0), Prior(), 50000)
pred = predict(lm(0, 0), chain)
Summary Statistics
parameters mean std mcse ess_bulk ess_tail rhat ess_per_sec
Symbol Any Any Float64 Float64 Float64 Float64 Missing
Quantiles
parameters 2.5% 25.0% 50.0% 75.0% 97.5%
Symbol Any Any Any Any Any
DataFrame(pred)
50000×2 DataFrame
Row │ iteration chain
│ Int64 Int64
───────┼──────────────────
1 │ 1 1
2 │ 2 1
3 │ 3 1
4 │ 4 1
5 │ 5 1
6 │ 6 1
⋮ │ ⋮ ⋮
49995 │ 49995 1
49996 │ 49996 1
49997 │ 49997 1
49998 │ 49998 1
49999 │ 49999 1
50000 │ 50000 1
49988 rows omitted
Is there something I am missing?
Metadata
Metadata
Assignees
Labels
No labels