Skip to content

Commit 7140f3d

Browse files
committed
Format HISTORY.md
1 parent 161edf8 commit 7140f3d

File tree

1 file changed

+61
-62
lines changed

1 file changed

+61
-62
lines changed

HISTORY.md

Lines changed: 61 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,76 +4,75 @@
44

55
**Breaking**
66

7-
- For submodels constructed using `to_submodel`, the order in which nested prefixes are applied has been changed.
8-
Previously, the order was that outer prefixes were applied first, then inner ones.
9-
This version reverses that.
10-
To illustrate:
11-
12-
```julia
13-
using DynamicPPL, Distributions
14-
15-
@model function subsubmodel()
16-
x ~ Normal()
17-
end
18-
19-
@model function submodel()
20-
x ~ to_submodel(prefix(subsubmodel(), :c), false)
21-
return x
22-
end
23-
24-
@model function parentmodel()
25-
x1 ~ to_submodel(prefix(submodel(), :a), false)
26-
x2 ~ to_submodel(prefix(submodel(), :b), false)
27-
end
28-
29-
keys(VarInfo(parentmodel()))
30-
```
31-
32-
Previously, the final line would return the variable names `c.a.x` and `c.b.x`.
33-
With this version, it will return `a.c.x` and `b.c.x`, which is more intuitive.
34-
(Note that this change brings `to_submodel`'s behaviour in line with the now-deprecated `@submodel` macro.)
35-
36-
This change also affects sampling in Turing.jl.
37-
7+
- For submodels constructed using `to_submodel`, the order in which nested prefixes are applied has been changed.
8+
Previously, the order was that outer prefixes were applied first, then inner ones.
9+
This version reverses that.
10+
To illustrate:
11+
12+
```julia
13+
using DynamicPPL, Distributions
14+
15+
@model function subsubmodel()
16+
return x ~ Normal()
17+
end
18+
19+
@model function submodel()
20+
x ~ to_submodel(prefix(subsubmodel(), :c), false)
21+
return x
22+
end
23+
24+
@model function parentmodel()
25+
x1 ~ to_submodel(prefix(submodel(), :a), false)
26+
return x2 ~ to_submodel(prefix(submodel(), :b), false)
27+
end
28+
29+
keys(VarInfo(parentmodel()))
30+
```
31+
32+
Previously, the final line would return the variable names `c.a.x` and `c.b.x`.
33+
With this version, it will return `a.c.x` and `b.c.x`, which is more intuitive.
34+
(Note that this change brings `to_submodel`'s behaviour in line with the now-deprecated `@submodel` macro.)
35+
36+
This change also affects sampling in Turing.jl.
3837
3938
## 0.34.2
4039
41-
- Fixed bugs in ValuesAsInModelContext as well as DebugContext where underlying PrefixContexts were not being applied.
42-
From a user-facing perspective, this means that for models which use manually prefixed submodels, e.g.
43-
44-
```julia
45-
using DynamicPPL, Distributions
46-
47-
@model inner() = x ~ Normal()
48-
49-
@model function outer()
50-
x1 ~ to_submodel(prefix(inner(), :a), false)
51-
x2 ~ to_submodel(prefix(inner(), :b), false)
52-
end
53-
```
54-
55-
will: (1) no longer error when sampling due to `check_model_and_trace`; and (2) contain both submodel's variables in the resulting chain (the behaviour before this patch was that the second `x` would override the first `x`).
56-
57-
- More broadly, implemented a general `prefix(ctx::AbstractContext, ::VarName)` which traverses the context tree in `ctx` to apply all necessary prefixes. This was a necessary step in fixing the above issues, but it also means that `prefix` is now capable of handling context trees with e.g. multiple prefixes at different levels of nesting.
40+
- Fixed bugs in ValuesAsInModelContext as well as DebugContext where underlying PrefixContexts were not being applied.
41+
From a user-facing perspective, this means that for models which use manually prefixed submodels, e.g.
42+
43+
```julia
44+
using DynamicPPL, Distributions
45+
46+
@model inner() = x ~ Normal()
47+
48+
@model function outer()
49+
x1 ~ to_submodel(prefix(inner(), :a), false)
50+
return x2 ~ to_submodel(prefix(inner(), :b), false)
51+
end
52+
```
53+
54+
will: (1) no longer error when sampling due to `check_model_and_trace`; and (2) contain both submodel's variables in the resulting chain (the behaviour before this patch was that the second `x` would override the first `x`).
55+
56+
- More broadly, implemented a general `prefix(ctx::AbstractContext, ::VarName)` which traverses the context tree in `ctx` to apply all necessary prefixes. This was a necessary step in fixing the above issues, but it also means that `prefix` is now capable of handling context trees with e.g. multiple prefixes at different levels of nesting.
5857

5958
## 0.34.1
6059

61-
- Fix an issue that prevented merging two VarInfos if they had different dimensions for a variable.
60+
- Fix an issue that prevented merging two VarInfos if they had different dimensions for a variable.
6261

63-
- Upper bound the compat version of KernelAbstractions to work around an issue in determining the right VarInfo type to use.
62+
- Upper bound the compat version of KernelAbstractions to work around an issue in determining the right VarInfo type to use.
6463

6564
## 0.34.0
6665

6766
**Breaking**
6867

69-
- `rng` argument removed from `values_as_in_model`, and `varinfo` made non-optional. This means that the only signatures allowed are
70-
71-
```
72-
values_as_in_model(::Model, ::Bool, ::AbstractVarInfo)
73-
values_as_in_model(::Model, ::Bool, ::AbstractVarInfo, ::AbstractContext)
74-
```
75-
76-
If you aren't using this function (it's probably only used in Turing.jl) then this won't affect you.
68+
- `rng` argument removed from `values_as_in_model`, and `varinfo` made non-optional. This means that the only signatures allowed are
69+
70+
```
71+
values_as_in_model(::Model, ::Bool, ::AbstractVarInfo)
72+
values_as_in_model(::Model, ::Bool, ::AbstractVarInfo, ::AbstractContext)
73+
```
74+
75+
If you aren't using this function (it's probably only used in Turing.jl) then this won't affect you.
7776

7877
## 0.33.1
7978

@@ -84,10 +83,10 @@ There are no changes to the public-facing API, but internally you can no longer
8483

8584
**Breaking**
8685

87-
- `values_as_in_model()` now requires an extra boolean parameter, specifying whether variables on the lhs of `:=` statements are to be included in the resulting `OrderedDict` of values.
88-
The type signature is now `values_as_in_model([rng,] model, include_colon_eq::Bool [, varinfo, context])`
86+
- `values_as_in_model()` now requires an extra boolean parameter, specifying whether variables on the lhs of `:=` statements are to be included in the resulting `OrderedDict` of values.
87+
The type signature is now `values_as_in_model([rng,] model, include_colon_eq::Bool [, varinfo, context])`
8988

9089
**Other**
9190

92-
- Moved the implementation of `predict` from Turing.jl to DynamicPPL.jl; the user-facing behaviour is otherwise the same
93-
- Improved error message when a user tries to initialise a model with parameters that don't correspond strictly to the underlying VarInfo used
91+
- Moved the implementation of `predict` from Turing.jl to DynamicPPL.jl; the user-facing behaviour is otherwise the same
92+
- Improved error message when a user tries to initialise a model with parameters that don't correspond strictly to the underlying VarInfo used

0 commit comments

Comments
 (0)