TuringLang / AbstractMCMC.jl

Abstract types and interfaces for Markov chain Monte Carlo methods
https://turinglang.org/AbstractMCMC.jl
MIT License
78 stars 18 forks source link

Ensure ensemble sampling is reproducible #97

Closed devmotion closed 2 years ago

devmotion commented 2 years ago

I noticed that in #95 I accidentally introduced a reproducibility issue for multithreaded sampling: If seeds are set for each chunk (as in the PR), then the samples will depend on the number of threads. This PR fixes the issue and reverts this change: For each chain, the RNG is set to a specific reproducible seed.

Additionally, I added the same seeds to the serial sampling (they are already used in the distributed sampling). This ensures that the samples do not depend on the chosen ensemble methods. It could be removed from the PR if not desired.

codecov[bot] commented 2 years ago

Codecov Report

Merging #97 (20ffc79) into master (24f88b1) will increase coverage by 0.01%. The diff coverage is 100.00%.

:exclamation: Current head 20ffc79 differs from pull request most recent head 22299e2. Consider uploading reports for the commit 22299e2 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #97      +/-   ##
==========================================
+ Coverage   97.73%   97.74%   +0.01%     
==========================================
  Files           7        7              
  Lines         221      222       +1     
==========================================
+ Hits          216      217       +1     
  Misses          5        5              
Impacted Files Coverage Δ
src/sample.jl 98.05% <100.00%> (+0.01%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6dae58b...22299e2. Read the comment docs.

cpfiffer commented 2 years ago

I rolled the version up because I submitted 3.3.1 too early, woops :disappointed_relieved:

devmotion commented 2 years ago

Hmm are you sure? Wasn't 3.3.1 correct? With 3.3.2 automerge complains: https://github.com/JuliaRegistries/General/pull/55232