Turing.jl: Pass args... to DynamicNUTS

Created on 26 Dec 2020  路  6Comments  路  Source: TuringLang/Turing.jl

Hello,

From the documentation of DynamicNUTS, which if I understood correctly should be a wrapper to DynamicHMC.jl, I'm not able to understand how to pass to DynamicHMC arguments like initialization and warmup_stages, that you may find in the DynamicHMC documentation above.

Thanks in advance

Most helpful comment

In general, NUTS is better supported and has more options.

All 6 comments

DynamicHMC arguments are not supported currently and hence not listed in the documentation.

The implementation does not wrap DynamicHMC.mcmc_with_warmup but instead wraps the unofficial internal iteration interface with AbstractMCMC. This enables some features that are not supported by DynamicHMC, such as thinning, discarding initial samples, and parallel sampling instead.

In general, NUTS is better supported and has more options.

Thank you very much.

Hello @devmotion ,

is there any way we can pass initial parameter values to NUTS or other samplers?

I see that there is a argument to this sample method, but I'm not sure that it is the one that gets called when we do things like:

chain2 = sample(model2, NUTS(.45), MCMCThreads(), 5000, 3, progress=false)

( example taken from the docs ).

EDIT: I think I answered myself: guide

AdvancedHMC does not use AbstractMCMC (yet), so it does implement sample in a different way and with different options than Turing and other AbstractMCMC-dependent packages, and in particular it can't benefit from the AbstractMCMC defaults such as parallel sampling and the DynamicPPL defaults for parameter initialization. You can specify initial values of a Turing model with init_params (the documentation is not correct here) but there are some caveats and unfortunately I noticed a bug when running a simple example. It is fixed by https://github.com/TuringLang/DynamicPPL.jl/pull/210, you can have a look at the PR for some examples as well. The main limitation of init_params currently (which should be changed) is that you have to specify values for all parameters in the order they appear in the Turing model as a collection of arrays and/or scalars. If some parameters should not be initialized, this can indicated by a missing value.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mateuszbaran picture mateuszbaran  路  5Comments

yebai picture yebai  路  4Comments

willtebbutt picture willtebbutt  路  4Comments

trappmartin picture trappmartin  路  3Comments

yebai picture yebai  路  6Comments