Skip to content
Merged
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
13 changes: 12 additions & 1 deletion developers/compiler/minituring-compiler/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,18 @@ We define the probabilistic model:
end;
```

We perform inference with data `x = 3.0`:
The `@mini_model` macro expands this into another function, `m`, which effectively calls either `assume` or `observe` on each variable as needed:

```{julia}
@macroexpand @mini_model function m(x)
a ~ Normal(0.5, 1)
b ~ Normal(a, 2)
x ~ Normal(b, 0.5)
return nothing
end
```

We can use this function to construct the `MiniModel`, and then perform inference with data `x = 3.0`:

```{julia}
sample(MiniModel(m, (x=3.0,)), MHSampler(), 1_000_000; chain_type=Chains, progress=false)
Expand Down
Loading