Closed axsk closed 8 years ago
I see. It looks like a change is needed in the reset!
function in initialization.jl. Something along the lines of
function reset!(m::Model, iter::Integer)
m.iter = iter
if iter == 0
for s in m.samplers
s.tune["sampler"] = nothing
end
end
m
end
I don't really see a reason for the reset! function at all. It is not exported and called only from setstate!. All it does is setting the m.iter field, which I think belongs directly to setstate!, and resets the samplers on the first run, but they are initialized with the sampler field set to nothing anyhow.
To me it is also not clear what resetting a model could mean semantically.
As I mentioned in #66 I would avoid using the tune["sampler"] field in favor of a sampler specific tune type. That way one could define a reset!(::SpecificSampler) method which basically does what setting tune["sampler"]=nothing does now implicitly, it would just be more explicit and, in my eyes, Julian.
If resetting all model samplers is still desired one could define resetsamplers! which just dispatches to each's block reset!(::Sampler) function.
The mcmc continuation issue is fixed in the latest Mamba release (0.7.3). I'll respond to the sampler comment in the other thread in which it was brought up.
Consider following example:
I actually use similar code to save the results to a file while computing them.
Unfortunately something goes wrong with the continuation using mcmc(::ModelChains, ...). The qualitative behaviour of the random walk switches randomly on some of the 1000th's iterations, as one can see in the following example plot: