AbstractPPL v0.13.0
There are no breaking changes; however, we opted to make a minor release given the substantial amount of new code.
Minimum compatibility has been bumped to Julia 1.10.
Added the new functions hasvalue(container::T, ::VarName[, ::Distribution])
and getvalue(container::T, ::VarName[, ::Distribution])
, where T
is either NamedTuple
or AbstractDict{<:VarName}
.
These functions check whether a given VarName
has a value in the given NamedTuple
or AbstractDict
, and return the value if it exists.
The optional Distribution
argument allows one to reconstruct a full value from its component indices.
For example, if container
has x[1]
and x[2]
, then hasvalue(container, @varname(x), dist)
will return true if size(dist) == (2,)
(for example, MvNormal(zeros(2), I)
).
In this case plain hasvalue(container, @varname(x))
would return false
, since we can not know whether the vector-valued variable x
has all of its elements specified in container
(there might be an x[3]
missing).
These functions (without the Distribution
argument) were previously in DynamicPPL.jl (albeit unexported).
Merged pull requests:
- Move
hasvalue
andgetvalue
from DynamicPPL; implement extra Distributions-based methods (#125) (@penelopeysm)
Closed issues:
- hasvalue and getvalue (#124)