-
Notifications
You must be signed in to change notification settings - Fork 9
Move hasvalue
and getvalue
from DynamicPPL; implement extra Distributions-based methods
#125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
56b9f2c
646b9d7
07975a2
332c64a
049001e
e0adba7
9291e07
a736e70
5a902b0
0e8d256
29dc922
a998af6
6a01588
ecf0eac
8dc53d8
a85e0e0
7fac592
5fa6a53
b4f69b1
00520c3
d25f0be
e20190c
49922f0
70182a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
## 0.13.0 | ||
|
||
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)`). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you consider having the third argument be the dimension, rather than the distribution? I'm not sure at all that this would be better, but it would avoid a dependence on Distributions.jl for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We were so close, it's just Cholesky that breaks it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is another option actually, which is instead of taking a Distribution, take a value sampled from that Distribution. That means we would only need a dependency on LinearAlgebra rather than Distributions. However, that would mean an additional call to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somehow dealing with a sample also just feel dirty and wrong. The julia> size(LKJCholesky(2, 1.0))
(2, 2) thing just feels wrong, or maybe rather we need |
||
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). | ||
|
||
penelopeysm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
These functions (without the `Distribution` argument) were previously in DynamicPPL.jl (albeit unexported). | ||
|
||
## 0.12.0 | ||
|
||
### VarName constructors | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
[deps] | ||
AbstractPPL = "7a57a42e-76ec-4ea3-a279-07e840d6d9cf" | ||
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" |
Uh oh!
There was an error while loading. Please reload this page.