|
2 | 2 |
|
3 | 3 | ## 0.37.0
|
4 | 4 |
|
5 |
| -**Breaking changes** |
| 5 | +DynamicPPL 0.37 comes with a substantial reworking of its internals. |
| 6 | +Fundamentally, there is no change to the actual modelling syntax: if you are a Turing.jl user, for example, this release is unlikely to affect you much. |
| 7 | +However, if you are a package developer or someone who uses DynamicPPL's functionality directly, you will notice a number of changes. |
| 8 | + |
| 9 | +To avoid overwhelming the reader, we begin by listing the most important, user-facing changes, before explaining the changes to the internals in more detail. |
| 10 | + |
| 11 | +Note that virtually all changes listed here are breaking. |
| 12 | + |
| 13 | +**Public-facing changes** |
6 | 14 |
|
7 | 15 | ### Submodel macro
|
8 | 16 |
|
9 | 17 | The `@submodel` macro is fully removed; please use `to_submodel` instead.
|
10 | 18 |
|
| 19 | +### `DynamicPPL.TestUtils.AD.run_ad` |
| 20 | + |
| 21 | +The three keyword arguments, `test`, `reference_backend`, and `expected_value_and_grad` have been merged into a single `test` keyword argument. |
| 22 | +Please see the API documentation for more details. |
| 23 | +(The old `test=true` and `test=false` values are still valid, and you only need to adjust the invocation if you were explicitly passing the `reference_backend` or `expected_value_and_grad` arguments.) |
| 24 | + |
| 25 | +There is now also an `rng` keyword argument to help seed parameter generation. |
| 26 | + |
| 27 | +Finally, instead of specifying `value_atol` and `grad_atol`, you can now specify `atol` and `rtol` which are used for both value and gradient. |
| 28 | +Their semantics are the same as in Julia's `isapprox`; two values are equal if they satisfy either `atol` or `rtol`. |
| 29 | + |
| 30 | +### `DynamicPPL.TestUtils.check_model` |
| 31 | + |
| 32 | +You now need to explicitly pass a `VarInfo` argument to `check_model` and `check_model_and_trace`. |
| 33 | +Previously, these functions would generate a new VarInfo for you (using an optionally provided `rng`). |
| 34 | + |
| 35 | +### Removal of `PriorContext` and `LikelihoodContext` |
| 36 | + |
| 37 | +A number of DynamicPPL's contexts have been removed, most notably `PriorContext` and `LikelihoodContext`. |
| 38 | +Although these are not the only _exported_ contexts, we consider unlikely that anyone was using _other_ contexts manually: if you have a question about contexts _other_ than these, please continue reading the 'Internals' section below. |
| 39 | + |
| 40 | +Previously, during evaluation of a model, DynamicPPL only had the capability to store a _single_ log probability (`logp`) field. |
| 41 | +`DefaultContext`, `PriorContext`, and `LikelihoodContext` were used to control what this field represented: they would accumulate the log joint, log prior, or log likelihood, respectively. |
| 42 | + |
| 43 | +Now, we have reworked DynamicPPL's `VarInfo` object such that it can track multiple log probabilities at once (see the 'Accumulators' section below). |
| 44 | +If you were evaluating a model with `PriorContext`, you can now just evaluate it with `DefaultContext`, and instead of calling `getlogp(varinfo)`, you can call `getlogprior(varinfo)` (and similarly for the likelihood). |
| 45 | + |
| 46 | +If you were constructing a `LogDensityFunction` with `PriorContext`, you can now stick to `DefaultContext`. |
| 47 | +`LogDensityFunction` now has an extra field, called `getlogdensity`, which represents a function that takes a `VarInfo` and returns the log density you want. |
| 48 | +Thus, if you pass `getlogprior` as the value of this parameter, you will get the same behaviour as with `PriorContext`. |
| 49 | + |
| 50 | +The other case where one might use `PriorContext` was to use `@addlogprob!` to add to the log prior. |
| 51 | +Previously, this was accomplished by manually checking `__context__ isa DynamicPPL.PriorContext`. |
| 52 | +Now, you can write `@addlogprob (; logprior=x, loglikelihood=y)` to add `x` to the log-prior and `y` to the log-likelihood. |
| 53 | + |
| 54 | +**Internals** |
| 55 | + |
11 | 56 | ### Accumulators
|
12 | 57 |
|
13 | 58 | This release overhauls how VarInfo objects track variables such as the log joint probability. The new approach is to use what we call accumulators: Objects that the VarInfo carries on it that may change their state at each `tilde_assume!!` and `tilde_observe!!` call based on the value of the variable in question. They replace both variables that were previously hard-coded in the `VarInfo` object (`logp` and `num_produce`) and some contexts. This brings with it a number of breaking changes:
|
@@ -59,6 +104,18 @@ And a couple of more internal changes:
|
59 | 104 | - The model evaluation function, `model.f` for some `model::Model`, no longer takes a context as an argument
|
60 | 105 | - The internal representation and API dealing with submodels (i.e., `ReturnedModelWrapper`, `Sampleable`, `should_auto_prefix`, `is_rhs_model`) has been simplified. If you need to check whether something is a submodel, just use `x isa DynamicPPL.Submodel`. Note that the public API i.e. `to_submodel` remains completely untouched.
|
61 | 106 |
|
| 107 | +## 0.36.15 |
| 108 | + |
| 109 | +Bumped minimum Julia version to 1.10.8 to avoid potential crashes with `Core.Compiler.widenconst` (which Mooncake uses). |
| 110 | + |
| 111 | +## 0.36.14 |
| 112 | + |
| 113 | +Added compatibility with [email protected]. |
| 114 | + |
| 115 | +## 0.36.13 |
| 116 | + |
| 117 | +Added documentation for the `returned(::Model, ::MCMCChains.Chains)` method. |
| 118 | + |
62 | 119 | ## 0.36.12
|
63 | 120 |
|
64 | 121 | Removed several unexported functions.
|
|
0 commit comments