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
+91Lines changed: 91 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,97 @@ This release overhauls how VarInfo objects track variables such as the log joint
18
18
-`getlogp` now returns a `NamedTuple` with keys `logprior` and `loglikelihood`. If you want the log joint probability, which is what `getlogp` used to return, use `getlogjoint`.
19
19
- Correspondingly `setlogp!!` and `acclogp!!` should now be called with a `NamedTuple` with keys `logprior` and `loglikelihood`. The `acclogp!!` method with a single scalar value has been deprecated and falls back on `accloglikelihood!!`, and the single scalar version of `setlogp!!` has been removed. Corresponding setter/accumulator functions exist for the log prior as well.
20
20
21
+
### Evaluation contexts
22
+
23
+
Historically, evaluating a DynamicPPL model has required three arguments: a model, some kind of VarInfo, and a context.
24
+
It's less known, though, that since DynamicPPL 0.14.0 the _model_ itself actually contains a context as well.
25
+
This version therefore excises the context argument, and instead uses `model.context` as the evaluation context.
26
+
27
+
The upshot of this is that many functions that previously took a context argument now no longer do.
28
+
There were very few such functions where the context argument was actually used (most of them simply took `DefaultContext()` as the default value).
29
+
30
+
`evaluate!!(model, varinfo, ext_context)` is deprecated, and broadly speaking you should replace calls to that with `new_model = contextualize(model, ext_context); evaluate!!(new_model, varinfo)`.
31
+
If the 'external context' `ext_context` is a parent context, then you should wrap `model.context` appropriately to ensure that its information content is not lost.
32
+
If, on the other hand, `ext_context` is a `DefaultContext`, then you can just drop the argument entirely.
33
+
34
+
To aid with this process, `contextualize` is now exported from DynamicPPL.
35
+
36
+
The main situation where one _did_ want to specify an additional evaluation context was when that context was a `SamplingContext`.
37
+
Doing this would allow you to run the model and sample fresh values, instead of just using the values that existed in the VarInfo object.
38
+
Thus, this release also introduces the **unexported** function `evaluate_and_sample!!`.
39
+
Essentially, `evaluate_and_sample!!(rng, model, varinfo, sampler)` is a drop-in replacement for `evaluate!!(model, varinfo, SamplingContext(rng, sampler))`.
40
+
**Do note that this is an internal method**, and its name or semantics are liable to change in the future without warning.
41
+
42
+
There are many methods that no longer take a context argument, and listing them all would be too much.
43
+
However, here are the more user-facing ones:
44
+
45
+
-`LogDensityFunction` no longer has a context field (or type parameter)
46
+
-`DynamicPPL.TestUtils.AD.run_ad` no longer uses a context (and the returned `ADResult` object no longer has a context field)
47
+
-`VarInfo(rng, model, sampler)` and other VarInfo constructors / functions that made VarInfos (e.g. `typed_varinfo`) from a model
48
+
-`(::Model)(args...)`: specifically, this now only takes `rng` and `varinfo` arguments (with both being optional)
49
+
- If you are using the `__context__` special variable inside a model, you will now have to use `__model__.context` instead
50
+
51
+
And a couple of more internal changes:
52
+
53
+
-`evaluate!!`, `evaluate_threadsafe!!`, and `evaluate_threadunsafe!!` no longer accept context arguments
54
+
-`evaluate!!` no longer takes rng and sampler (if you used this, you should use `evaluate_and_sample!!` instead, or construct your own `SamplingContext`)
55
+
- The model evaluation function, `model.f` for some `model::Model`, no longer takes a context as an argument
56
+
57
+
## 0.36.12
58
+
59
+
Removed several unexported functions.
60
+
The only notable one is `DynamicPPL.alg_str`, which was used in old versions of AdvancedVI and the Turing test suite.
61
+
62
+
## 0.36.11
63
+
64
+
Make `ThreadSafeVarInfo` hold a total of `Threads.nthreads() * 2` logp values, instead of just `Threads.nthreads()`.
65
+
This fix helps to paper over the cracks in using `threadid()` to index into the `ThreadSafeVarInfo` object.
66
+
67
+
## 0.36.10
68
+
69
+
Added compatibility with ForwardDiff 1.0.
70
+
71
+
## 0.36.9
72
+
73
+
Fixed a failure when sampling from `ProductNamedTupleDistribution` due to
74
+
missing `tovec` methods for `NamedTuple` and `Tuple`.
75
+
76
+
## 0.36.8
77
+
78
+
Made `LogDensityFunction` a subtype of `AbstractMCMC.AbstractModel`.
79
+
80
+
## 0.36.7
81
+
82
+
Added compatibility with MCMCChains 7.0.
83
+
84
+
## 0.36.6
85
+
86
+
`DynamicPPL.TestUtils.run_ad` now takes an extra `context` keyword argument, which is passed to the `LogDensityFunction` constructor.
87
+
88
+
## 0.36.5
89
+
90
+
`varinfo[:]` now returns an empty vector if `varinfo::DynamicPPL.NTVarInfo` is empty, rather than erroring.
91
+
92
+
In its place, `check_model` now issues a warning if the model is empty.
93
+
94
+
## 0.36.4
95
+
96
+
Added compatibility with DifferentiationInterface.jl 0.7, and also with JET.jl 0.10.
97
+
98
+
The JET compatibility entry should only affect you if you are using DynamicPPL on the Julia 1.12 pre-release.
99
+
100
+
## 0.36.3
101
+
102
+
Moved the `bijector(model)`, where `model` is a `DynamicPPL.Model`, function from the Turing main repo.
0 commit comments