Hello,
I’m new to Turing so this might just be a beginners error but when I try following code
using Turing
@model function gdemo(x, y)
s² ~ InverseGamma(2, 3)
m ~ Normal(0, sqrt(s²))
x .~ Normal(m, sqrt(s²))
y ~ Normal(m, sqrt(s²))
end
mdl = gdemo(missing,missing)
chn = sample(mdl,NUTS(0.65),1000)
I get the following error
ERROR: LoadError: MethodError: no method matching dot_assume(::Random._GLOBAL_RNG, ::DynamicPPL.SampleFromUniform, ::Normal{Float64}, ::AbstractPPL.VarName{:x, Tuple{}}, ::Missing, ::DynamicPPL.UntypedVarInfo{DynamicPPL.Metadata{Dict{AbstractPPL.VarName, Int64}, Vector{Distribution}, Vector{AbstractPPL.VarName}, Vector{Real}, Vector{Set{DynamicPPL.Selector}}}, Float64})
Closest candidates are:
dot_assume(::Any, ::Union{DynamicPPL.SampleFromPrior, DynamicPPL.SampleFromUniform}, ::Union{AbstractArray{var"#s79", N} where {var"#s79"<:Distribution, N}, Distribution}, ::AbstractArray{var"#s78", N} where {var"#s78"<:AbstractPPL.VarName, N}, ::AbstractArray, ::Any) at /home/waweros/.julia/packages/DynamicPPL/RcfQU/src/context_implementations.jl:458
dot_assume(::Any, ::DynamicPPL.Sampler{var"#s152"} where var"#s152"<:MH, ::Union{AbstractArray{var"#s151", N} where {var"#s151"<:Distribution, N}, Distribution}, ::AbstractPPL.VarName, ::AbstractArray, ::Any) at /home/waweros/.julia/packages/Turing/uMQmD/src/inference/mh.jl:472
dot_assume(::Any, ::DynamicPPL.Sampler, ::Any, ::AbstractArray{var"#s79", N} where {var"#s79"<:AbstractPPL.VarName, N}, ::Any, ::Any) at /home/waweros/.julia/packages/DynamicPPL/RcfQU/src/context_implementations.jl:471
With a stack trace leading back to the sampler if I remove the .~
then everything’s fine. The issue is that with the code I originally found the behavior with it’s a lot harder to remove all the broadcasting when I want to sample the prior.
Does anyone have any idea what I should do?