Turing.jl
Turing.jl copied to clipboard
Sampler initialization (`init_params`)
Hi!
Could you add some documentation to sampler initialization (init_params)? Right now it's quite non-intuitive to use.
I'm currently using the NUTS sampler for my model and unfortunately it tends to pick initial values of random variables that are far from the expected ones, and my model has numerical issues at such extreme values. Thus I'd like to start with some more likely initial values.
I'm not even sure how to use init_params, I tried that:
@model function test(x)
a ~ Normal(1.0, 2.0)
println(a)
x ~ filldist(Normal(a, 0.1), length(x))
return a
end
sample(test([1.0, 2.0, 1.3]), NUTS(), 10; init_params = [3.1])
and it never goes through a equal to 3.1 (that value is never printed).
After some investigation it looks like this line: https://github.com/TuringLang/DynamicPPL.jl/blob/3602c56dba16bc2b60efbef6bf6ff31226354c7d/src/sampler.jl#L80 resets initialization for HMC samplers (but not for MH).
Likely fixed by https://github.com/TuringLang/DynamicPPL.jl/pull/232