ptiede / Comrade.jl

MIT License
43 stars 8 forks source link

Make HMC sampler resumable #337

Closed kazuakiyama closed 4 months ago

kazuakiyama commented 4 months ago

The current sample method can save checkpoints with scans of chains and tuned HMC sampler configurations in disk, but doesn't support resuming from a checkpoint. The application of comrade HMC samplers will get wider if it has an option to resume a previous run from a checkpoint, as this allows a long run often chucked in multiple MCMC runs.

ptiede commented 4 months ago

So looking through the code it appears I actually did implement this, I just never tested it. Could you try passing restart=true to the sample function and see if it resumes?

ptiede commented 4 months ago

@kazuakiyama, my local testing seems to suggest the current functionality works. One thing that is missing is changing the number of samples you want. That was just added in commit 1ca888ee35ee4f41cfdf37aa6964f5db3ca32849 and will be included in the next release which will likely get tagged tonight

ptiede commented 4 months ago

This seems to work now. @kazuakiyama please reopen the issue if there is a remaining bug

kazuakiyama commented 4 months ago

Thanks a lot! We will test it in the next few days, and let you know if we find anything.

kazuakiyama commented 4 months ago

@ptiede Now I've confirmed that HMC is resumable with the latest version! Thanks a lot for doing this so quickly!