Skip to content

Commit 28e5ba4

Browse files
committed
DebugContext -> DebugAccumulator
1 parent a0289db commit 28e5ba4

File tree

4 files changed

+161
-225
lines changed

4 files changed

+161
-225
lines changed

src/accumulators.jl

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ function accumulate_observe!! end
5353
5454
Update `acc` in a `tilde_assume!!` call. Returns the updated `acc`.
5555
56-
`vn` is the name of the variable being assumed, `val` is the value of the variable, and
57-
`right` is the distribution on the RHS of the tilde statement. `logjac` is the log
58-
determinant of the Jacobian of the transformation that was done to convert the value of `vn`
59-
as it was given (e.g. by sampler operating in linked space) to `val`.
56+
`vn` is the name of the variable being assumed, `val` is the value of the variable (in the
57+
original, unlinked space), and `right` is the distribution on the RHS of the tilde
58+
statement. `logjac` is the log determinant of the Jacobian of the transformation that was
59+
done to convert the value of `vn` as it was given to `val`: for example, if the sampler is
60+
operating in linked (Euclidean) space, then logjac will be nonzero.
6061
6162
`accumulate_assume!!` may mutate `acc`, but not any of the other arguments.
6263
@@ -71,16 +72,16 @@ Return a new accumulator like `acc` but empty.
7172
7273
The precise meaning of "empty" is that that the returned value should be such that
7374
`combine(acc, split(acc))` is equal to `acc`. This is used in the context of multi-threading
74-
where different threads may accumulate independently and the results are the combined.
75+
where different threads may accumulate independently and the results are then combined.
7576
7677
See also: [`combine`](@ref)
7778
"""
7879
function split end
7980

8081
"""
81-
combine(acc::AbstractAccumulator, acc2::AbstractAccumulator)
82+
combine(acc::TAcc, acc2::TAcc) where {TAcc<:AbstractAccumulator}
8283
83-
Combine two accumulators of the same type. Returns a new accumulator.
84+
Combine two accumulators of the same type. Returns a new accumulator of the same type.
8485
8586
See also: [`split`](@ref)
8687
"""
@@ -126,8 +127,10 @@ end
126127
AccumulatorTuple(accs::Vararg{AbstractAccumulator}) = AccumulatorTuple(accs)
127128
AccumulatorTuple(nt::NamedTuple) = AccumulatorTuple(tuple(nt...))
128129

129-
# When showing with text/plain, leave out information about the wrapper AccumulatorTuple.
130-
Base.show(io::IO, mime::MIME"text/plain", at::AccumulatorTuple) = show(io, mime, at.nt)
130+
# When showing with text/plain, leave out type information about the wrapper AccumulatorTuple.
131+
function Base.show(io::IO, mime::MIME"text/plain", at::AccumulatorTuple)
132+
return "AccumulatorTuple(" * show(io, mime, at.nt) * ")"
133+
end
131134
Base.getindex(at::AccumulatorTuple, idx) = at.nt[idx]
132135
Base.length(::AccumulatorTuple{N}) where {N} = N
133136
Base.iterate(at::AccumulatorTuple, args...) = iterate(at.nt, args...)

src/contexts.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ end
472472
"""
473473
conditioned(context::AbstractContext)
474474
475-
Return `NamedTuple` of values that are conditioned on under context`.
475+
Return a `Dict{VarName,Any}` of the values that are conditioned on under `context`.
476476
477477
Note that this will recursively traverse the context stack and return
478478
a merged version of the condition values.

0 commit comments

Comments
 (0)