Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion developers/inference/abstractmcmc-turing/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ $$

with $\theta_{\text{prop}}$ a sample from the proposal and $x_{\text{obs}}$ the observed data.

This begs the question: how can these functions access model information during sampling? Recall that the model is stored as an instance `m` of `Model`. One of the attributes of `m` is the model evaluation function `m.f`, which is built by compiling the `@model` macro. Executing `f` runs the tilde statements of the model in order, and adds model information to the sampler (the instance of `Sampler` that stores information about the ongoing sampling process) at each step (see [here](https://turinglang.org/dev/docs/for-developers/compiler) for more information about how the `@model` macro is compiled). The DynamicPPL functions `assume` and `observe` determine what kind of information to add to the sampler for every tilde statement.
This begs the question: how can these functions access model information during sampling? Recall that the model is stored as an instance `m` of `Model`. One of the attributes of `m` is the model evaluation function `m.f`, which is built by compiling the `@model` macro. Executing `f` runs the tilde statements of the model in order, and adds model information to the sampler (the instance of `Sampler` that stores information about the ongoing sampling process) at each step (see [here]({{<meta dev-model-manual>}}) for more information about how the `@model` macro is compiled). The DynamicPPL functions `assume` and `observe` determine what kind of information to add to the sampler for every tilde statement.

Consider an instance `m` of `Model` and a sampler `spl`, with associated `VarInfo` `vi = spl.state.vi`. At some point during the sampling process, an AbstractMCMC function such as `step!` calls `m(vi, ...)`, which calls the model evaluation function `m.f(vi, ...)`.

Expand Down
2 changes: 1 addition & 1 deletion faq/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Turing.jl fully supports sampling multiple chains in parallel:
- **Multithreaded sampling**: Use `MCMCThreads()` to run one chain per thread
- **Distributed sampling**: Use `MCMCDistributed()` for distributed computing

See the [Core Functionality guide]({{< meta core-functionality >}}/#sampling-multiple-chains) for examples.
See the [Core Functionality guide]({{<meta core-functionality>}}#sampling-multiple-chains) for examples.

### 2. Threading Within Models
Using threads inside your model (e.g., `Threads.@threads`) requires more care:
Expand Down
2 changes: 1 addition & 1 deletion tutorials/bayesian-logistic-regression/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ chain
::: {.callout-warning collapse="true"}
## Sampling With Multiple Threads
The `sample()` call above assumes that you have at least `nchains` threads available in your Julia instance. If you do not, the multiple chains
will run sequentially, and you may notice a warning. For more information, see [the Turing documentation on sampling multiple chains.](https://turinglang.org/dev/docs/using-turing/guide/#sampling-multiple-chains)
will run sequentially, and you may notice a warning. For more information, see [the Turing documentation on sampling multiple chains.]({{<meta core-functionality>}}#sampling-multiple-chains)
:::

```{julia}
Expand Down
2 changes: 1 addition & 1 deletion tutorials/bayesian-poisson-regression/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ chain
::: {.callout-warning collapse="true"}
## Sampling With Multiple Threads
The `sample()` call above assumes that you have at least `nchains` threads available in your Julia instance. If you do not, the multiple chains
will run sequentially, and you may notice a warning. For more information, see [the Turing documentation on sampling multiple chains.](https://turinglang.org/dev/docs/using-turing/guide/#sampling-multiple-chains)
will run sequentially, and you may notice a warning. For more information, see [the Turing documentation on sampling multiple chains.]({{<meta core-functionality>}}#sampling-multiple-chains)
:::

# Viewing the Diagnostics
Expand Down