Skip to content

Commit 11c55d3

Browse files
committed
Update docstrings
1 parent 9aa0a9a commit 11c55d3

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/context_implementations.jl

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ function tilde(ctx::MiniBatchContext, sampler, right, left::VarName, inds, vi)
3636
end
3737

3838
"""
39-
tilde_assume(ctx, sampler, right, vn, inds, vi)
39+
tilde_assume(ctx, sampler, right, vn, inds, vi) -> sampled value
4040
4141
This method is applied in the generated code for assumed variables, e.g., `x ~ Normal()` where
4242
`x` does not occur in the model inputs.
4343
44-
Falls back to `tilde(ctx, sampler, right, vn, inds, vi)`.
44+
Falls back to `tilde(ctx, sampler, right, vn, inds, vi)`, but automatically accumulates the
45+
log-probability and returns only the sampled value.
4546
"""
4647
function tilde_assume(ctx, sampler, right, vn, inds, vi)
4748
value, logp = tilde(ctx, sampler, right, vn, inds, vi)
@@ -72,13 +73,14 @@ function tilde(ctx::MiniBatchContext, sampler, right, left, vi)
7273
end
7374

7475
"""
75-
tilde_observe(ctx, sampler, right, left, vname, vinds, vi)
76+
tilde_observe(ctx, sampler, right, left, vname, vinds, vi) -> observed value
7677
7778
This method is applied in the generated code for observed variables, e.g., `x ~ Normal()` where
7879
`x` does occur in the model inputs.
7980
80-
Falls back to `tilde(ctx, sampler, right, left, vi)` ignoring the information about variable
81-
name and indices; if needed, these can be accessed through this function, though.
81+
Falls back to `tilde(ctx, sampler, right, left, vi)` ignoring the information about variable name
82+
and indices; if needed, these can be accessed through this function, though. Automatically
83+
accumulates the log-probability and returns only the observed value.
8284
"""
8385
function tilde_observe(ctx, sampler, right, left, vname, vinds, vi)
8486
logp = tilde(ctx, sampler, right, left, vi)
@@ -87,10 +89,11 @@ function tilde_observe(ctx, sampler, right, left, vname, vinds, vi)
8789
end
8890

8991
"""
90-
tilde_observe(ctx, sampler, right, left, vi)
92+
tilde_observe(ctx, sampler, right, left, vi) -> observed value
9193
9294
This method is applied in the generated code for observed constants, e.g., `1.0 ~ Normal()`.
93-
Falls back to `tilde(ctx, sampler, right, left, vi)`.
95+
Falls back to `tilde(ctx, sampler, right, left, vi)`. Automatically accumulates the log-probability
96+
and returns only the observed value.
9497
"""
9598
function tilde_observe(ctx, sampler, right, left, vi)
9699
logp = tilde(ctx, sampler, right, left, vi)
@@ -195,12 +198,13 @@ function dot_tilde(
195198
end
196199

197200
"""
198-
dot_tilde_assume(ctx, sampler, right, left, vn, inds, vi)
201+
dot_tilde_assume(ctx, sampler, right, left, vn, inds, vi) -> sampled value
199202
200203
This method is applied in the generated code for assumed vectorized variables, e.g., `x .~
201204
MvNormal()` where `x` does not occur in the model inputs.
202205
203-
Falls back to `dot_tilde(ctx, sampler, right, left, vn, inds, vi)`.
206+
Falls back to `dot_tilde(ctx, sampler, right, left, vn, inds, vi)`, but automatically accumulates
207+
the log-probability and returns only the sampled value.
204208
"""
205209
function dot_tilde_assume(ctx, sampler, right, left, vn, inds, vi)
206210
value, logp = dot_tilde(ctx, sampler, right, left, vn, inds, vi)
@@ -373,13 +377,14 @@ function dot_tilde(ctx::MiniBatchContext, sampler, right, left, vi)
373377
end
374378

375379
"""
376-
dot_tilde_observe(ctx, sampler, right, left, vname, vinds, vi)
380+
dot_tilde_observe(ctx, sampler, right, left, vname, vinds, vi) -> observed value
377381
378382
This method is applied in the generated code for vectorized observed variables, e.g., `x .~
379383
MvNormal()` where `x` does occur the model inputs.
380384
381385
Falls back to `dot_tilde(ctx, sampler, right, left, vi)` ignoring the information about variable
382-
name and indices; if needed, these can be accessed through this function, though.
386+
name and indices; if needed, these can be accessed through this function, though. Automatically
387+
accumulates the log-probability and returns only the observed value.
383388
"""
384389
function dot_tilde_observe(ctx, sampler, right, left, vn, inds, vi)
385390
logp = dot_tilde(ctx, sampler, right, left, vi)
@@ -388,10 +393,11 @@ function dot_tilde_observe(ctx, sampler, right, left, vn, inds, vi)
388393
end
389394

390395
"""
391-
dot_tilde_observe(ctx, sampler, right, left, vi)
396+
dot_tilde_observe(ctx, sampler, right, left, vi) -> observed value
392397
393398
This method is applied in the generated code for vectorized observed constants, e.g., `[1.0] .~
394-
MvNormal()`. Falls back to `dot_tilde(ctx, sampler, right, left, vi)`.
399+
MvNormal()`. Falls back to `dot_tilde(ctx, sampler, right, left, vi)`. Automatically
400+
accumulates the log-probability and returns only the observed value.
395401
"""
396402
function dot_tilde_observe(ctx, sampler, right, left, vi)
397403
logp = dot_tilde(ctx, sampler, right, left, vi)

0 commit comments

Comments
 (0)