Skip to content

Commit ca882d6

Browse files
mhauruyebaiwilltebbutt
authored
Context tutorial (#481)
* Add context tutorial * Add more detail about contexts to compiler design page * Apply suggestions from code review Co-authored-by: Hong Ge <[email protected]> * Use explicit imports in contexts * Remove unnecessary deps for contexts * Update page titles to match ToC * Improve a paragraph in context tutorial * Small fixes to contexts tutorial * Apply review feedback Co-authored-by: Will Tebbutt <[email protected]> * Apply review feedback Co-authored-by: Will Tebbutt <[email protected]> * Clarify a sentence in context tutorial --------- Co-authored-by: Hong Ge <[email protected]> Co-authored-by: Will Tebbutt <[email protected]>
1 parent 71e2303 commit ca882d6

File tree

6 files changed

+1742
-8
lines changed

6 files changed

+1742
-8
lines changed

_quarto.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ website:
9696
- text: "How to Contribute"
9797
href: tutorials/docs-01-contributing-guide/index.qmd
9898
- tutorials/docs-05-for-developers-compiler/index.qmd
99-
- text: "A Mini Turing Compiler"
99+
- text: "A Mini Turing Implementation I: Compiler"
100100
href: tutorials/14-minituring/index.qmd
101+
- text: "A Mini Turing Implementation II: Contexts"
102+
href: tutorials/16-contexts/index.qmd
101103
- tutorials/docs-06-for-developers-interface/index.qmd
102104

103105

tutorials/14-minituring/index.qmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: MiniTuring
2+
title: "A Mini Turing Implementation I: Compiler"
33
engine: julia
44
---
55

@@ -81,8 +81,8 @@ For instance, in some cases we might want to sample all variables from their pri
8181
Thus depending on the inference algorithm we want to use different `assume` and `observe` implementations.
8282
We can achieve this by providing this `context` information as a function argument to `assume` and `observe`.
8383

84-
**Note:** *Although the context system in this tutorial is inspired by DynamicPPL, Turing's context system is much more complicated for flexibility and efficiency reasons.
85-
Thus readers are advised to refer to the documentation of DynamicPPL and Turing for more detailed information about their context system.*
84+
**Note:** *Although the context system in this tutorial is inspired by DynamicPPL, it is very simplistic.
85+
We expand this mini Turing example in the [contexts](../16-contexts) tutorial with some more complexity, to illustrate how and why contexts are central to Turing's design. For the full details one still needs to go to the actual source of DynamicPPL though.*
8686

8787
Here we can see the implementation of a sampler that draws values of unobserved variables from the prior and computes the log-probability for every variable.
8888

@@ -290,4 +290,4 @@ end
290290
sample(turing_m(3.0), MH(ScalMat(2, 1.0)), 1_000_000, progress=false)
291291
```
292292

293-
As you can see, with our simple probabilistic programming language and custom samplers we get similar results as Turing.
293+
As you can see, with our simple probabilistic programming language and custom samplers we get similar results as Turing.

0 commit comments

Comments
 (0)