TuringLang / docs

Documentation and tutorials for the Turing language
https://turinglang.org/docs/
MIT License
232 stars 100 forks source link

AbstractMCMC.step!() is deprecated #517

Open enguang2 opened 3 years ago

enguang2 commented 3 years ago

Hello, I am just reading https://turing.ml/dev/docs/for-developers/interface and the example there gives step!() which is no longer used as I believe, and the bundle_samples() is also old and won't work with current AbstractMCMC Maybe someone can help updating the docs?

devmotion commented 3 years ago

The documentation of AbstractMCMC in the README should be correct: https://github.com/TuringLang/AbstractMCMC.jl If not, please open an issue or a PR :slightly_smiling_face:

Generally, the Turing docs are quite outdated (see https://github.com/TuringLang/TuringTutorials/issues/86 and related issues). One problem is that currently the webpage is reorganized, moved to a separate repository, and the tutorials are ported from Jupyter notebooks to more manageable Julia markdown files. The other more general problem is that often it takes a while for changes to propagate to downstream packages such as Turing. E.g., for AbstractMCMC 2 large parts of Turing (and DynamicPPL) had to be rewritten, and therefore it took several months before Turing started to use the new version of AbstractMCMC. So it is not possible to update the Turing documentation when changes are introduced in the satellite packages if one does not want to confuse Turing users (they would read about something that is not available in Turing yet). So therefore the official documentation for now is the README file.

bgctw commented 3 years ago

@devmotion told that the docu is outdated. Nevertheless I report problems and potential fixes to hopefully help updating the docu:

I get the following error: in_support: error in method definition: function Distributions.insupport must be explicitly imported to be extended One could use a different function name to avoid this conflict with the previously imported Distributions package: e.g. insupport_normal.

The choice of the initial values is unfortunate: a spread parameter of zero is not in the support. θ_0 = [0.0, 1.0]

The bundle_sample is never called, because the signature does not match: The current signature in AbstractMCMC is: bundle_samples(samples, model, sampler, state, chain_type[; kwargs...])

When I call the bundle_samples function then I get the following error: UndefVarError: Chains not defined One should add: using MCMCChains

I miss from the Documentation what is the second return value in the current step function.

I would be happy about a continued tutorial, where the same MCMC sampling (instead of or in addition to the Importance Sample) is implemented using Turing.

enguang2 commented 3 years ago

@bgctw Been a while from last comment, but I'm recently planning to rewrite the interface guide tutorial and pull request it to Turing website. I also noticed that Chains function missing error. After using MCMCChains, a workaround way is to downgrade the AbstractMCMC package to a much older version(noticed this can be a dangerous action as julia will automatically downgrade all dependents of AbstractMCMC). For julia 1.5, It's fine to use

Pkg.add(Pkg.PackageSpec(;name="AbstractMCMC", version="0.5.3"))

to downgrade it, now the tutorial shall work.