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
* Refactor dot_tilde, work in progress
* Restrict dot_tilde to univariate dists on the RHS
* Remove tests with multivariates or arrays as RHS of .~
* emove dot_tilde pipeline
* Fix a .~ bug
* Update HISTORY.md
* Fix a tiny test bug
* Re-enable some SimpleVarInfo tests
* Improve changelog entry
* Improve error message
* Fix trivial typos
* Fix pointwise_logdensity test
* Remove pointless check_dot_tilde_rhs method
* Add tests for old .~ syntax
* Bump Mooncake patch version to v0.4.90
* Bump Mooncake to 0.4.95
---------
Co-authored-by: Penelope Yong <[email protected]>
Copy file name to clipboardExpand all lines: HISTORY.md
+69-1
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,74 @@
4
4
5
5
**Breaking**
6
6
7
+
### `.~` right hand side must be a univariate distribution
8
+
9
+
Previously we allowed statements like
10
+
11
+
```julia
12
+
x .~ [Normal(), Gamma()]
13
+
```
14
+
15
+
where the right hand side of a `.~` was an array of distributions, and ones like
16
+
17
+
```julia
18
+
x .~MvNormal(fill(0.0, 2), I)
19
+
```
20
+
21
+
where the right hand side was a multivariate distribution.
22
+
23
+
These are no longer allowed. The only things allowed on the right hand side of a `.~` statement are univariate distributions, such as
24
+
25
+
```julia
26
+
x =Array{Float64,3}(undef, 2, 3, 4)
27
+
x .~Normal()
28
+
```
29
+
30
+
The reasons for this are internal code simplification and the fact that broadcasting where both sides are multidimensional but of different dimensions is typically confusing to read.
31
+
32
+
If the right hand side and the left hand side have the same dimension, one can simply use `~`. Arrays of distributions can be replaced with `product_distribution`. So instead of
33
+
34
+
```julia
35
+
x .~ [Normal(), Gamma()]
36
+
x .~Normal.(y)
37
+
x .~MvNormal(fill(0.0, 2), I)
38
+
```
39
+
40
+
do
41
+
42
+
```julia
43
+
x ~product_distribution([Normal(), Gamma()])
44
+
x ~product_distribution(Normal.(y))
45
+
x ~MvNormal(fill(0.0, 2), I)
46
+
```
47
+
48
+
This is often more performant as well. Note that using `~` rather than `.~` does change the internal storage format a bit: With `.~``x[i]` are stored as separate variables, with `~` as a single multivariate variable `x`. In most cases this does not change anything for the user, but if it does cause issues, e.g. if you are dealing with `VarInfo` objects directly and need to keep the old behavior, you can always expand into a loop, such as
49
+
50
+
```julia
51
+
dists =Normal.(y)
52
+
for i in1:length(dists)
53
+
x[i] ~ dists[i]
54
+
end
55
+
```
56
+
57
+
Cases where the right hand side is of a different dimension than the left hand side, and neither is a scalar, must be replaced with a loop. For example,
58
+
59
+
```julia
60
+
x =Array{Float64,3}(undef, 2, 3, 4)
61
+
x .~MvNormal(fill(0, 2), I)
62
+
```
63
+
64
+
should be replaced with something like
65
+
66
+
```julia
67
+
x =Array{Float64,3}(2, 3, 4)
68
+
for i in1:3, j in1:4
69
+
x[:, i, j] ~MvNormal(fill(0, 2), I)
70
+
end
71
+
```
72
+
73
+
This release also completely rewrites the internal implementation of `.~`, where from now on all `.~` statements are turned into loops over `~` statements at macro time. However, the only breaking aspect of this change is the above change to what's allowed on the right hand side.
74
+
7
75
### Remove indexing by samplers
8
76
9
77
This release removes the feature of `VarInfo` where it kept track of which variable was associated with which sampler. This means removing all user-facing methods where `VarInfo`s where being indexed with samplers. In particular,
@@ -14,7 +82,7 @@ This release removes the feature of `VarInfo` where it kept track of which varia
14
82
-`unflatten` no longer accepts a sampler as an argument
15
83
-`eltype(::VarInfo)` no longer accepts a sampler as an argument
16
84
-`keys(::VarInfo)` no longer accepts a sampler as an argument
17
-
-`VarInfo(::VarInfo, ::Sampler, ::AbstactVector)` no longer accepts the sampler argument.
85
+
-`VarInfo(::VarInfo, ::Sampler, ::AbstractVector)` no longer accepts the sampler argument.
18
86
-`push!!` and `push!` no longer accept samplers or `Selector`s as arguments
19
87
-`getgid`, `setgid!`, `updategid!`, `getspace`, and `inspace` no longer exist
0 commit comments