Skip to content

Commit 88da7bd

Browse files
committed
Changelog
1 parent 28e5ba4 commit 88da7bd

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

HISTORY.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22

33
## 0.37.0
44

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**
614

715
### Submodel macro
816

@@ -19,6 +27,32 @@ There is now also an `rng` keyword argument to help seed parameter generation.
1927
Finally, instead of specifying `value_atol` and `grad_atol`, you can now specify `atol` and `rtol` which are used for both value and gradient.
2028
Their semantics are the same as in Julia's `isapprox`; two values are equal if they satisfy either `atol` or `rtol`.
2129

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+
2256
### Accumulators
2357

2458
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:

0 commit comments

Comments
 (0)