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
+56-34
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
**Breaking changes**
6
6
7
-
### Submodels
7
+
### Submodels: conditioning
8
8
9
9
Variables in a submodel can now be conditioned and fixed in a correct way.
10
10
See https://github.com/TuringLang/DynamicPPL.jl/issues/857 for a full illustration, but essentially it means you can now do this:
@@ -22,38 +22,7 @@ end
22
22
and the `inner.x` variable will be correctly conditioned.
23
23
(Previously, you would have to condition `inner()` with the variable `a.x`, meaning that you would need to know what prefix to use before you had actually prefixed it.)
24
24
25
-
### AD testing utilities
26
-
27
-
`DynamicPPL.TestUtils.AD.run_ad` now links the VarInfo by default.
28
-
To disable this, pass the `linked=false` keyword argument.
29
-
If the calculated value or gradient is incorrect, it also throws a `DynamicPPL.TestUtils.AD.ADIncorrectException` rather than a test failure.
30
-
This exception contains the actual and expected gradient so you can inspect it if needed; see the documentation for more information.
31
-
From a practical perspective, this means that if you need to add this to a test suite, you need to use `@test run_ad(...) isa Any` rather than just `run_ad(...)`.
32
-
33
-
### SimpleVarInfo linking / invlinking
34
-
35
-
Linking a linked SimpleVarInfo, or invlinking an unlinked SimpleVarInfo, now displays a warning instead of an error.
36
-
37
-
### VarInfo constructors
38
-
39
-
`VarInfo(vi::VarInfo, values)` has been removed. You can replace this directly with `unflatten(vi, values)` instead.
40
-
41
-
The `metadata` argument to `VarInfo([rng, ]model[, sampler, context, metadata])` has been removed.
42
-
If you were not using this argument (most likely), then there is no change needed.
43
-
If you were using the `metadata` argument to specify a blank `VarNamedVector`, then you should replace calls to `VarInfo` with `DynamicPPL.typed_vector_varinfo` instead (see 'Other changes' below).
44
-
45
-
The `UntypedVarInfo` constructor and type is no longer exported.
46
-
If you needed to construct one, you should now use `DynamicPPL.untyped_varinfo` instead.
47
-
48
-
The `TypedVarInfo` constructor and type is no longer exported.
49
-
The _type_ has been replaced with `DynamicPPL.NTVarInfo`.
50
-
The _constructor_ has been replaced with `DynamicPPL.typed_varinfo`.
51
-
52
-
Note that the exact kind of VarInfo returned by `VarInfo(rng, model, ...)` is an implementation detail.
53
-
Previously, it was guaranteed that this would always be a VarInfo whose metadata was a `NamedTuple` containing `Metadata` structs.
54
-
Going forward, this is no longer the case, and you should only assume that the returned object obeys the `AbstractVarInfo` interface.
55
-
56
-
### VarName prefixing behaviour
25
+
### Submodel prefixing
57
26
58
27
The way in which VarNames in submodels are prefixed has been changed.
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.
67
+
In a similar way, if the variable on the left-hand side of your tilde statement is not just a single identifier, any fields or indices it accesses are now properly respected.
68
+
Consider the following setup:
69
+
70
+
```julia
71
+
using DynamicPPL, Distributions
72
+
@modelinner() = x ~Normal()
73
+
@modelfunctionouter()
74
+
a =Vector{Float64}(undef, 1)
75
+
a[1] ~to_submodel(inner())
76
+
return a
77
+
end
78
+
```
79
+
80
+
In this case, the variable sampled is actually the `x` field of the first element of `a`:
Before this version, it used to be the a single variable called `var"a[1].x"`.
88
+
89
+
Note that 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.
99
90
(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.)
100
91
92
+
### AD testing utilities
93
+
94
+
`DynamicPPL.TestUtils.AD.run_ad` now links the VarInfo by default.
95
+
To disable this, pass the `linked=false` keyword argument.
96
+
If the calculated value or gradient is incorrect, it also throws a `DynamicPPL.TestUtils.AD.ADIncorrectException` rather than a test failure.
97
+
This exception contains the actual and expected gradient so you can inspect it if needed; see the documentation for more information.
98
+
From a practical perspective, this means that if you need to add this to a test suite, you need to use `@test run_ad(...) isa Any` rather than just `run_ad(...)`.
99
+
100
+
### SimpleVarInfo linking / invlinking
101
+
102
+
Linking a linked SimpleVarInfo, or invlinking an unlinked SimpleVarInfo, now displays a warning instead of an error.
103
+
104
+
### VarInfo constructors
105
+
106
+
`VarInfo(vi::VarInfo, values)` has been removed. You can replace this directly with `unflatten(vi, values)` instead.
107
+
108
+
The `metadata` argument to `VarInfo([rng, ]model[, sampler, context, metadata])` has been removed.
109
+
If you were not using this argument (most likely), then there is no change needed.
110
+
If you were using the `metadata` argument to specify a blank `VarNamedVector`, then you should replace calls to `VarInfo` with `DynamicPPL.typed_vector_varinfo` instead (see 'Other changes' below).
111
+
112
+
The `UntypedVarInfo` constructor and type is no longer exported.
113
+
If you needed to construct one, you should now use `DynamicPPL.untyped_varinfo` instead.
114
+
115
+
The `TypedVarInfo` constructor and type is no longer exported.
116
+
The _type_ has been replaced with `DynamicPPL.NTVarInfo`.
117
+
The _constructor_ has been replaced with `DynamicPPL.typed_varinfo`.
118
+
119
+
Note that the exact kind of VarInfo returned by `VarInfo(rng, model, ...)` is an implementation detail.
120
+
Previously, it was guaranteed that this would always be a VarInfo whose metadata was a `NamedTuple` containing `Metadata` structs.
121
+
Going forward, this is no longer the case, and you should only assume that the returned object obeys the `AbstractVarInfo` interface.
122
+
101
123
**Other changes**
102
124
103
125
While these are technically breaking, they are only internal changes and do not affect the public API.
@@ -252,10 +252,11 @@ The general strategy that we adopt is similar to above.
252
252
Following the principle that `PrefixContext` should be nested inside the outer context, but outside the inner submodel's context, we can infer that the correct context inside `charlie` should be:
0 commit comments