Skip to content

v0.38.0

Choose a tag to compare

@github-actions github-actions released this 09 May 09:49
· 62 commits to main since this release
05110bd

Turing v0.38.0

Diff since v0.37.0

:

Breaking changes

DynamicPPL compatibility has been bumped to 0.36.
This brings with it a number of changes: the ones most likely to affect you are submodel prefixing and conditioning.
Variables in submodels are now represented correctly with field accessors.
For example:

using Turing
@model inner() = x ~ Normal()
@model outer() = a ~ to_submodel(inner())

keys(VarInfo(outer())) now returns [@varname(a.x)] instead of [@varname(var"a.x")]

Furthermore, you can now either condition on the outer model like outer() | (@varname(a.x) => 1.0), or the inner model like inner() | (@varname(x) => 1.0).
If you use the conditioned inner model as a submodel, the conditioning will still apply correctly.

Please see the DynamicPPL release notes for fuller details.

Gibbs sampler

Turing's Gibbs sampler now allows for more complex VarNames, such as x[1] or x.a, to be used.
For example, you can now do this:

@model function f()
    x = Vector{Float64}(undef, 2)
    x[1] ~ Normal()
    return x[2] ~ Normal()
end
sample(f(), Gibbs(@varname(x[1]) => MH(), @varname(x[2]) => MH()), 100)

Performance for the cases which used to previously work (i.e. VarNames like x which only consist of a single symbol) is unaffected, and VarNames with only field accessors (e.g. x.a) should be equally fast.
It is possible that VarNames with indexing (e.g. x[1]) may be slower (although this is still an improvement over not working at all!).
If you find any cases where you think the performance is worse than it should be, please do file an issue.

Merged pull requests:

Closed issues:

  • New Turing domain: please visit turinglang.org (#2041)
  • Allow Gibbs sampler to have non-identity lenses for target variables (#2403)
  • Figure out a consistent and robust way of defining and testing interfaces (#2434)
  • Clean up exports (#2468)
  • Clean up LogDensityFunctions interface code + setADtype (#2473)
  • prefix should be exported (#2481)
  • Enzyme illegal type analysis on many Turing models (#2510)
  • NaN error during sampling with NUTS in Hidden Markov Model (#2513)
  • Bug: Incorrect Variance Test in check_dist_numerical (#2514)
  • NaN in dataset leads to NaN parameters and difficult-to-interpret errors (#2515)
  • Can't find initial parameters in HMM with deterministic emissions (#2526)
  • Run formatter, start using always_use_return = true (#2530)
  • Remove extract_priors (#2537)