Initial values for multiple chains
Closed this issue · 3 comments
Brian,
I came across a problem when creating arrays for initial values in multiple chains. In the below example, inits1 works while inits 2 does not in mcmc
inits1 = [
Dict(:y => Data[:y], :m =>0, :sd_m => 1),
Dict(:y => Data[:y], :m =>0, :sd_m => 1)
]
inits2 = [
Dict(:y => Data[:y], :m =>0, :sd_m => 1)
for i in 1:2
]
The difference is:
julia> typeof(inits1)
Array{Dict{Symbol,Any},1}
julia> typeof(inits2)
Array{Any,1}
the signature of mcmc will not recognize the second.
I really like the package and I look forward to using it more.
Michael Sonksen
Hi @sonksen,
Thanks for the note. You're right that the second inits2
formulation of initial values is not of the Array{Dict{Symbol,Any},1}
type required by the mcmc
function. Below is one way the formulation can be modified to ensure that the required type is produced.
inits2 = Dict{Symbol,Any}[
Dict(:y => Data[:y], :m => 0, :sd_m => 1)
for i in 1:2
]
Thanks Brian!
Michael Sonksen
You're welcome.