This repository contains tutorials on the universal probabilistic programming language Turing.
The tutorials are defined in the tutorials
folder.
All the outputs are generated automatically from that.
Additional educational materials can be found at StatisticalRethinkingJulia/TuringModels.jl, which contains Turing adaptations of models from Richard McElreath's Statistical Rethinking. It is a highly recommended resource if you are looking for a greater breadth of examples.
To run the tutorials interactively via Jupyter notebooks, install the package and open the tutorials like:
# Install TuringTutorials
using Pkg
pkg"add https://github.com/TuringLang/TuringTutorials"
# Generate notebooks in subdirectory "notebook"
using TuringTutorials
TuringTutorials.weave(; build=(:notebook,))
# Start Jupyter in "notebook" subdirectory
using IJulia
IJulia.notebook(; dir="notebook")
You can weave the notebooks to a different folder with
TuringTutorials.weave(; build=(:notebook,), out_path_root="my/custom/directory")
Then the notebooks will be generated in the folder my/custom/directory/notebook
and you can start Jupyter with
IJulia.notebook(; dir="my/custom/directory/notebook")
First of all, make sure that your current directory is TuringTutorials
.
All of the files are generated from the jmd files in the tutorials
folder.
So to change a tutorial, change one of the .jmd
file in the tutorials
folder.
To run the generation process, do for example:
using TuringTutorials
TuringTutorials.weave("00-introduction", "00_introduction.jmd")
To generate all files do:
TuringTutorials.weave()
If you add new tutorials which require new packages, simply updating your local environment will change the project and manifest files. When this occurs, the updated environment files should be included in the PR.
The structure of this repository is mainly based on SciMLTutorials.jl.