TuringLang / AbstractMCMC.jl

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

Allow to enable and disable progress logging globally #59

Closed devmotion closed 3 years ago

devmotion commented 3 years ago

This PR moves the setprogress! logic from Turing upstream. IMO it belongs here since it allows to tune the default keyword arguments. The change is non-breaking since the default is not changed and it can be specified in the sample/mcmcsample calls as before.

Some additional background: The main reason for mcmcsample is that Turing wants to use different default keyword arguments for sample but I guess it might be better to allow to set or define the keyword arguments instead. E.g., by adding an additional default_chain_type(model, sampler) = Any function that could be implemented as default_chain_type(::Model, ::Sampler{<:InferenceAlgorithm}) = Chain in Turing.

codecov[bot] commented 3 years ago

Codecov Report

Merging #59 (8c9db50) into master (7e0967a) will decrease coverage by 0.39%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #59      +/-   ##
==========================================
- Coverage   98.68%   98.28%   -0.40%     
==========================================
  Files           6        6              
  Lines         152      175      +23     
==========================================
+ Hits          150      172      +22     
- Misses          2        3       +1     
Impacted Files Coverage Δ
src/sample.jl 99.10% <100.00%> (+0.08%) :arrow_up:
src/logging.jl 95.00% <0.00%> (-5.00%) :arrow_down:
src/transducer.jl 100.00% <0.00%> (ø)
src/interface.jl 95.00% <0.00%> (+2.14%) :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 7e0967a...8c9db50. Read the comment docs.

cpfiffer commented 3 years ago

I'm all for it, thanks!