Hello again.
I am using Turing to re-create Facebook’s Prophet trend model. My model is:
@model Trend(Years, y) = begin
NumberOfChangepoints ~ DiscreteUniform(1, 5)
s = collect(range(Years[1], length=1+NumberOfChangepoints, stop=Years[end]))[2:end]
k ~ Normal(0., 5.) #Initial Rate
m ~ Normal(0., 5.) #Initial Intercept
λ ~ InverseGamma(1.5, 1.) #Diversity Prior
δ = Vector{Float64}(undef, NumberOfChangepoints) #Correction to initial rate for each changepoint
δ ~ [Laplace(0., λ)]
A = repeat(Years', NumberOfChangepoints)'
A = hcat(Array([A[:, i] .> s[i] for i in 1:NumberOfChangepoints] * 1)...)
γ = -[s[i]*δ[i] for i in 1:NumberOfChangepoints]
Slopes = A*δ .+ k
Intercepts = A*γ .+ m
Trend = Slopes .* Years .+ Intercepts
sd ~ InverseGamma(1.5, 1.)
for i in 1:size(y)[1]
y[i] ~ Normal(Trend[i], sd)
end
end
The issue is that I recieve the error
ERROR: [Turing] MH doesn't support vectorizing assume statement
My best guess is that it doesn’t like my δ vector. My sampler is such
chn = Turing.sample(Model, MH(), 10000)[3000:100:end]
since I’m unsure of how to implement PG along with NUTS. Thank you for your help