You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: HISTORY.md
+49Lines changed: 49 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,54 @@
1
1
# DynamicPPL Changelog
2
2
3
+
## 0.36.0
4
+
5
+
**Breaking changes**
6
+
7
+
### VarName prefixing behaviour
8
+
9
+
The way in which VarNames in submodels are prefixed has been changed.
10
+
This is best explained through an example.
11
+
Consider this model and submodel:
12
+
13
+
```julia
14
+
using DynamicPPL, Distributions
15
+
@modelinner() = x ~Normal()
16
+
@modelouter() = a ~to_submodel(inner())
17
+
```
18
+
19
+
In previous versions, the inner variable `x` would be saved as `a.x`.
20
+
However, this was represented as a single symbol `Symbol("a.x")`:
21
+
22
+
```julia
23
+
julia>dump(keys(VarInfo(outer()))[1])
24
+
VarName{Symbol("a.x"), typeof(identity)}
25
+
optic: identity (function of type typeof(identity))
26
+
```
27
+
28
+
Now, the inner variable is stored as a field `x` on the VarName `a`:
29
+
30
+
```julia
31
+
julia>dump(keys(VarInfo(outer()))[1])
32
+
VarName{:a, Accessors.PropertyLens{:x}}
33
+
optic: Accessors.PropertyLens{:x} (@o _.x)
34
+
```
35
+
36
+
In practice, this means that if you are trying to condition a variable in the submodel, you now need to use
37
+
38
+
```julia
39
+
outer() | (@varname(a.x) =>1.0,)
40
+
```
41
+
42
+
instead of either of these (which would have worked previously)
43
+
44
+
```julia
45
+
outer() | (@varname(var"a.x") =>1.0,)
46
+
outer() | (a.x =1.0,)
47
+
```
48
+
49
+
If you are sampling from a model with submodels, this doesn't affect the way you interact with the `MCMCChains.Chains` object, because VarNames are converted into Symbols when stored in the chain.
50
+
(This behaviour will likely be changed in the future, in that Chains should be indexable by VarNames and not just Symbols, but that has not been implemented yet.)
0 commit comments