Skip to content

Commit 05110bd

Browse files
authored
Update docstrings to account for non-identity varnames (#2546)
1 parent a3f0923 commit 05110bd

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

src/mcmc/gibbs.jl

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,16 @@ can_be_wrapped(ctx::DynamicPPL.PrefixContext) = can_be_wrapped(ctx.context)
3939
# - `GibbsContext` allows us to perform conditioning while still hit the `assume` pipeline
4040
# rather than the `observe` pipeline for the conditioned variables.
4141
"""
42-
GibbsContext{VNs}(global_varinfo, context)
42+
GibbsContext(target_varnames, global_varinfo, context)
4343
4444
A context used in the implementation of the Turing.jl Gibbs sampler.
4545
4646
There will be one `GibbsContext` for each iteration of a component sampler.
4747
48-
`VNs` is a a tuple of symbols for `VarName`s that the current component
49-
sampler is sampling. For those `VarName`s, `GibbsContext` will just pass `tilde_assume`
50-
calls to its child context. For other variables, their values will be fixed to the values
51-
they have in `global_varinfo`.
52-
53-
The naive implementation of `GibbsContext` would simply have a field `target_varnames` that
54-
would be a collection of `VarName`s that the current component sampler is sampling. The
55-
reason we instead have a `Tuple` type parameter listing `Symbol`s is to allow
56-
`is_target_varname` to benefit from compile time constant propagation. This is important
57-
for type stability of `tilde_assume`.
48+
`target_varnames` is a a tuple of `VarName`s that the current component sampler
49+
is sampling. For those `VarName`s, `GibbsContext` will just pass `tilde_assume`
50+
calls to its child context. For other variables, their values will be fixed to
51+
the values they have in `global_varinfo`.
5852
5953
# Fields
6054
$(FIELDS)
@@ -293,9 +287,6 @@ Gibbs(@varname(x) => NUTS(), @varname(y) => MH())
293287
Gibbs((@varname(x), :y) => NUTS(), :z => MH())
294288
```
295289
296-
Currently only variable names without indexing are supported, so for instance
297-
`Gibbs(@varname(x[1]) => NUTS())` does not work. This will hopefully change in the future.
298-
299290
# Fields
300291
$(TYPEDFIELDS)
301292
"""

0 commit comments

Comments
 (0)