From 626653475df6ae4275a6e012c4aaabcfd2facc96 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Tue, 29 Apr 2025 14:56:55 +0100 Subject: [PATCH 1/3] News 5 --- news/posts/2025-04-25-newsletter-5/index.qmd | 57 ++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 news/posts/2025-04-25-newsletter-5/index.qmd diff --git a/news/posts/2025-04-25-newsletter-5/index.qmd b/news/posts/2025-04-25-newsletter-5/index.qmd new file mode 100644 index 000000000..b6edb3873 --- /dev/null +++ b/news/posts/2025-04-25-newsletter-5/index.qmd @@ -0,0 +1,57 @@ +--- +title: Turing.jl Newsletter 5 +description: The fortnightly newsletter for the Turing.jl probabilistic programming language +categories: + - Newsletter +author: + - name: The TuringLang team + url: /team/ +date: 2025-04-25 +--- + +**DynamicPPL 0.36** + +A new minor version of DynamicPPL brings with it a few changes especially to the behaviour of submodels. These have not yet percolated up to Turing.jl, but will soon be. Firstly, prefixing behaviour is changed: consider these models + +```julia +@model function inner() + x ~ Normal() +end +@model function outer() + a = [0.0] + a[1] ~ to_submodel(inner()) +end +``` + +If you ran this model, you would find that the single random variable was called `a[1].x` — but this isn't the `x` field of the `1`st element of `a`, it's actually a variable whose name is literally just `Symbol("a[1].x")`. DynamicPPL changes this behaviour such that the variable is correctly recognised as the `x` field of the `1`st element of `a`. This means that if you are trying to, for example, condition on the variable, you can do: + +```julia +outer() | (@varname(a[1].x) => 1.0) +``` + +On the topic of conditioning, you can now also correctly condition or fix variables in a model before using it as a submodel, as this example demonstrates: + +```julia +@model function inner() + x ~ Normal() +end +@model function outer() + a ~ to_submodel(inner() | (@varname(x) => 1)) +end +``` + +Previously, if you wanted to do this, you would have to condition on `@varname(a.x)`, meaning that you'd need to know the prefix before conditioning it. The current system allows for more modular construction of nested models. + +For more complete details, please see [the release notes](https://github.com/TuringLang/DynamicPPL.jl/releases/tag/v0.36.0). + +**TuringBenchmarking.jl** + +DynamicPPL 0.36 also brings new functionality that can be used for testing and benchmarking automatic differentiation on Turing models. This is what powers the [ADTests table](https://turinglang.org/ADTests/), which we shared last time round. (Psst — there are more examples now than before!) + +For more information, see the docstring of `DynamicPPL.TestUtils.AD.run_ad` in [the DynamicPPL docs](https://turinglang.org/DynamicPPL.jl/stable/api/#DynamicPPL.TestUtils.AD.run_ad). + +As a corollary of this, the AD benchmarking functionalities in TuringBenchmarking.jl are not really needed anymore. If you are using this package, we recommend that you switch over to use the functionality that's directly built into DynamicPPL. + +**AdvancedHMC compatibility with ComponentArrays** + +AdvancedHMC had a fairly long-standing issue where it couldn't always be used with ComponentArrays as the position / momentum. This has now been fixed; you can take a look at [the test suite](https://github.com/TuringLang/AdvancedHMC.jl/blob/459ebb8a10cc1bc7dbbc27ed79afa796c607697a/test/hamiltonian.jl#L77-L100) to see examples of how they can be used together. From aff2b6f3b11c738e73bb411da89a9e60e888aea0 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Tue, 29 Apr 2025 15:05:04 +0100 Subject: [PATCH 2/3] Fix list --- news/posts/2025-03-14-newsletter-2/index.qmd | 1 + 1 file changed, 1 insertion(+) diff --git a/news/posts/2025-03-14-newsletter-2/index.qmd b/news/posts/2025-03-14-newsletter-2/index.qmd index c8917490e..85660d314 100644 --- a/news/posts/2025-03-14-newsletter-2/index.qmd +++ b/news/posts/2025-03-14-newsletter-2/index.qmd @@ -22,6 +22,7 @@ The SSMProblems.jl and GeneralisedFilters.jl packages have now been merged into **Smaller bits** Other code changes that have been merged: + - Some old code in AdvancedHMC.jl has been cleaned up quite a bit. See the [0.7.0 release](https://github.com/TuringLang/AdvancedHMC.jl/releases/tag/v0.7.0) for more information. - Turing's Gibbs sampler [now supports warmup steps properly](https://github.com/TuringLang/Turing.jl/pull/2502). We're still thinking about how to properly encode the scenario where different sub-samplers have different numbers of warmup steps, if you have any ideas, do get in touch on that PR. - We are going to formally remove support for Zygote as an AD backend. We don't test it thoroughly in Turing's test suite. You can of course still use Zygote yourself, simply load `ADTypes.AutoZygote()` — although we can't guarantee that we will fix any bugs that arise. From 5d35fc468db2743153d196b9368e48ae6da5614a Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Tue, 29 Apr 2025 15:05:35 +0100 Subject: [PATCH 3/3] Fix link --- news/posts/2025-03-14-newsletter-2/index.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/posts/2025-03-14-newsletter-2/index.qmd b/news/posts/2025-03-14-newsletter-2/index.qmd index 85660d314..b22a11bf0 100644 --- a/news/posts/2025-03-14-newsletter-2/index.qmd +++ b/news/posts/2025-03-14-newsletter-2/index.qmd @@ -17,7 +17,7 @@ Separately, we are planning to merge the benchmarking utilities in [TuringBenchm **SSMProblems** -The SSMProblems.jl and GeneralisedFilters.jl packages have now been merged into a single repository: https://github.com/TuringLang/SSMProblems.jl. This won't affect you if you are using the packages from the Julia General registry, but if you're looking to develop off the main branch you may have to use a different URL, or specify a subdirectory in `Pkg.add`. +The SSMProblems.jl and GeneralisedFilters.jl packages have now been merged into a single repository: [https://github.com/TuringLang/SSMProblems.jl](https://github.com/TuringLang/SSMProblems.jl). This won't affect you if you are using the packages from the Julia General registry, but if you're looking to develop off the main branch you may have to use a different URL, or specify a subdirectory in `Pkg.add`. **Smaller bits**