Skip to content

Releases

v0.49.0

Choose a tag to compare

@github-actions github-actions released this 13 Sep 12:32
9d78370

Turing v0.49.0

Diff since v0.48.0

DynamicPPL 0.42.13 is now the minimum, so that SMC, PG and CSMC build a TapedTask again (#2895).

Breaking changes

NamedDist is no longer re-exported, following its removal from DynamicPPL.
Replace x ~ NamedDist(dist, :y) with y ~ dist, followed by x = y if a local alias is needed (#2895).

Merged pull requests:

v0.48.0

Choose a tag to compare

@github-actions github-actions released this 04 Sep 19:23
b8af3d0

Turing v0.48.0

Diff since v0.47.4

Breaking changes

The SGLD and SGHMC samplers, which did not support minibatching, have been removed along with PolynomialStepsize (#2890).

MH(var => proposal, ...) and LinkedRW have been removed. Use MH() for prior proposals, or MH(cov_matrix) for a Gaussian random walk over the complete linked parameter vector. In Gibbs, assign MH(cov_matrix) to the target variable block (#2883).

Gibbs now conditions its components with DynamicPPL.condition. GibbsContext and Turing.Inference.make_conditional are removed. Rename isgibbscomponent to supports_gibbs and gibbs_get_raw_values to gibbs_get_parameter_values; the old names are deprecated. Gibbs no longer supports model arguments containing missing: declare the latent variable inside the model and condition on observations instead (#2863).

Every variable reached by a Gibbs model must belong to a component. A component may not change the dimension or existence of a variable owned only by another component; put the variable and whatever decides its shape in one block. Changes to another block's support or distributional form remain unchecked and can make the chain reducible; see the Gibbs docstring (#2863).

Other changes

ESS Gibbs components now use the current conditional prior after another component changes its parameters (#2885).

Gibbs chains now include component-sampler statistics (#2863).

NUTS and HMCDA now accept a NamedTuple or Dict{VarName} initial_params, which HMC already did (#2878).

Emcee now honours chain_type=MCMCChains.Chains, and refuses walkers that start in different parameter layouts instead of failing inside the decode or the stretch proposal (#2879).

estimate_mode now represents indexed bounds using the model's parameter shapes, avoiding growable-array warnings during optimisation (#2888).

estimate_mode now throws on a bound that does not cover a whole variable, where it previously either dropped it and returned the unconstrained mode or failed with a bare DimensionMismatch, and warns on a bound no variable can use rather than ignoring it in silence (#2880).

Prior() now warns that initial_params has no effect instead of discarding it silently (#2881).

Gibbs now rejects an external sampler whose state inherits AbstractMCMC's model-dropping three-argument setparams!! fallback, rather than running with stale model-dependent caches (#2891).

GibbsConditional now distinguishes a ranged tilde statement from multiple element-wise statements when given one conditional distribution (#2891).

Merged pull requests:

  • Gibbs: condition components instead of GibbsContext (#2863) (@yebai)
  • hmc: Convert initial_params for NUTS/HMCDA and delete a dead adaptor branch (#2878) (@yebai)
  • emcee: Honour chain_type and refuse walkers in different parameter layouts (#2879) (@yebai)
  • optimisation: Stop silently discarding lb/ub bounds (#2880) (@yebai)
  • prior: Warn that initial_params has no effect (#2881) (@yebai)
  • mh: remove per-variable proposals (#2883) (@yebai)
  • ESS retains stale prior means after Gibbs conditioning (#2885) (@yebai)
  • Reject model-dropping setparams!! in external Gibbs components (#2886) (@yebai)
  • optimisation: eliminate growable constraint warnings (#2888) (@yebai)
  • docs: clarify README (#2889) (@yebai)
  • Remove SGLD and SGHMC (#2890) (@yebai)
  • Fix Gibbs handling of wrapped external samplers and conditional sites (#2891) (@yebai)

Closed issues:

  • remove SGHMC / SGLD (#2270)
  • RepeatSampler should be in AbstractMCMC (#2671)
  • Gibbs does not use initialisation strategies for component samplers (#2693)
  • Stats from component samplers are lost with Gibbs (#2766)
  • Gibbs third branch (#2810)
  • Use Optim.jl for optimisation (#2814)
  • Rework Gibbs: replace GibbsContext with condition, complete the component interface (#2860)
  • Require samplers to opt in to varying-dimensional targets (#2866)
  • ESS in Gibbs retains stale conditional-prior means (#2873)
  • Reject model-dropping setparams!! before running external Gibbs samplers (#2875)
  • Misspecified MH proposals can bias sampling (#2876)

v0.47.4

Choose a tag to compare

@github-actions github-actions released this 02 Sep 11:40
81263ec

Turing v0.47.4

Diff since v0.47.3

externalsampler now forwards AbstractMCMC.step_warmup to the sampler it wraps, so an external sampler that adapts during warmup, such as AdvancedMH.RobustAdaptiveMetropolis, adapts instead of sampling with its initial proposal.

Merged pull requests:

Closed issues:

  • Remove HMC in favour of externalsampler(HMC) (#2592)
  • externalsampler does not forward step_warmup, so adaptive external samplers never adapt (#2870)

v0.47.3

Choose a tag to compare

@github-actions github-actions released this 01 Sep 18:11
e6b3582

Turing v0.47.3

Diff since v0.47.2

Random-measure distributions moved to the TuringDistributionsExt package extension. Replace
Turing.RandomMeasures with Base.get_extension(Turing, :TuringDistributionsExt).

Merged pull requests:

  • Move random measures to a Distributions extension (#2865) (@yebai)
  • docs: revise README and citation metadata (#2867) (@yebai)

v0.47.2

Choose a tag to compare

@github-actions github-actions released this 29 Aug 17:59
cf4110a

Turing v0.47.2

Diff since v0.47.1

Flat, FlatPos, BinomialLogit, OrderedLogistic, and LogPoisson moved to DynamicPPL and are re-exported, so Turing.Flat and the rest keep working. Requires DynamicPPL 0.42.7.

Merged pull requests:

Closed issues:

  • Move src/stdlib/distributions.jl to DynamicPPL. (#2858)

v0.47.1

Choose a tag to compare

@github-actions github-actions released this 27 Aug 20:06
a6b3c52

Turing v0.47.1

Diff since v0.47.0

setprogress! is now a re-export of AbstractMCMC.setprogress!, so Turing.setprogress!(false) keeps working and there is a single progress logging switch instead of two. The internal Turing.PROGRESS flag is gone, its state lives in AbstractMCMC.PROGRESS.

v0.47.0

Choose a tag to compare

@github-actions github-actions released this 27 Aug 15:52
7eebb9b

Turing v0.47.0

Diff since v0.46.1

Breaking changes

Particle MCMC (SMC and PG)

SMC and PG / CSMC have been reimplemented natively and no longer depend on AdvancedPS.

Resampling schemes are now types rather than functions: StratifiedResampler(), SystematicResampler(), and MultinomialResampler() (in Turing.Inference), optionally wrapped in ESSThresholdResampler(threshold, scheme) to resample only when the effective sample size falls below threshold * nparticles.
For example SMC(Turing.Inference.SystematicResampler()), SMC(0.5), or PG(10, Turing.Inference.MultinomialResampler(), 0.5).
The old function-based API (resample_systematic, AdvancedPS.ResampleWithESSThreshold, ...) is gone.

The default scheme is now stratified rather than systematic: it stays consistent as the number of particles grows, which systematic does not.
The selected scheme applies to unconditional sweeps only; PG / CSMC draw a conditional sweep's ancestors from the categorical over the weights.
Exact draws may therefore differ from previous releases, but remain statistically consistent (the same target distribution).

Chain statistics have changed: chain[:logevidence] is now chain[:log_normalizing_constant], and SMC's per-particle weight is gone, since the returned particles are now equal-weight.

SMC no longer has a sampler state, because it runs one sweep rather than an MCMC loop: save_state and initial_state are now warned about and ignored, so loadstate has nothing to return for an SMC chain. PG / CSMC are unaffected.

The rewrite also brings:

  • Reproducibility. Internal seeds are derived through a counter-based (Philox) generator, so a fixed user seed gives the same draws on every Julia version and platform. Previously, results could drift between Julia versions even under a StableRNG (#2781).
  • Parallelism within a sweep. SMC(; multithreaded=true) / PG(n; multithreaded=true) spread that sweep's particles across threads without changing the results; start Julia with multiple threads (e.g. julia -t auto) for this to take effect. It is independent of MCMCThreads() / MCMCDistributed(), which parallelise whole chains and work with SMC/PG as with any other sampler.
  • Equal-weight draws. SMC resamples once at the end of the sweep, so mean(chain[...]) and other summaries need no weighting.
  • A degeneracy diagnostic. SMC chains carry ess_per_step, the effective sample size after each filtering step; one entry per likelihood term, so an @addlogprob! adds one alongside the observations. MCMCChains exposes the entries as ess_per_step[1], ess_per_step[2], and so on.
  • For SMC, exp(log_normalizing_constant) is an unbiased estimator of the marginal likelihood p(y) under the usual particle-filter assumptions. For PG / CSMC it is biased and must not be used for model comparison (see the PG docstring).

Merged pull requests:

  • Move project instructions into AGENTS.md (#2857) (@yebai)

v0.46.1

Choose a tag to compare

@github-actions github-actions released this 21 Aug 13:01
6575e24

Turing v0.46.1

Diff since v0.46.0

Fixed a bug, present since v0.41.0, that biased PG / CSMC posteriors, whether sampled on their own or as a Gibbs component.

Merged pull requests:

v0.46.0

Choose a tag to compare

@github-actions github-actions released this 10 Jul 13:31
98e9773

Turing v0.46.0

Diff since v0.45.0

Breaking changes

DynamicPPL 0.42

Turing.jl v0.46 brings with it all the underlying changes in DynamicPPL 0.42.
Most notably, gradient preparation and evaluation now go through AbstractPPL's prepare / value_and_gradient!! interface.
This is an internal change and does not affect sampling results.
Please see the DynamicPPL changelog for full details, and the AdvancedVI section below for the user-facing changes in this release.

AdvancedVI 0.7

Turing.jl v0.46 also brings in the changes in AdvancedVI 0.7.
Please see the AdvancedVI changelog for full details; the changes most pertinent to users of vi are:

  • AutoReverseDiff(; compile=true) is no longer supported for VI, and is rejected with an ArgumentError, as compiled tapes can silently produce incorrect gradients when reused across optimisation steps.
    Use AutoReverseDiff(; compile=false), or a different reverse-mode backend such as AutoMooncake(), instead.
  • vi with KLMinScoreGradDescent now optimises in unconstrained (linked) space, making it consistent with the other KLMin... algorithms.
    If you use it with a model that has constrained parameters, results may differ slightly from previous releases.

Other changes

DifferentiationInterface removed as a direct dependency

informationmatrix (and hence vcov) now computes its Hessian through AbstractPPL's second-order interface instead of DifferentiationInterface. There is no change in behaviour for users.

Performance of nested submodels

DynamicPPL 0.42.1 fixes a type-inference failure that made nested submodels (a x ~ to_submodel(...) statement inside a model that is itself used as a submodel) many times slower to evaluate and differentiate; see #2844.

MCMCChains extension fix

Turing v0.45.0 was accidentally released without declaring the TuringMCMCChainsExt package extension, meaning that the extension did not load when MCMCChains was imported.
This broke some MCMCChains-specific functionality, such as loadstate (for resuming sampling from a previous chain) and the post-sampling divergence warnings for Hamiltonian samplers; this is now fixed.

Merged pull requests:

  • CompatHelper: add new compat entry for MCMCChains at version 7 for package test, (keep existing compat) (#2824) (@github-actions[bot])
  • CompatHelper: bump compat for AbstractPPL to 0.15, (keep existing compat) (#2826) (@github-actions[bot])
  • CompatHelper: bump compat for AbstractPPL to 0.15 for package test, (keep existing compat) (#2827) (@github-actions[bot])
  • Update README.md (#2829) (@yebai)
  • CompatHelper: bump compat for Bijectors to 0.16, (keep existing compat) (#2830) (@github-actions[bot])
  • CompatHelper: bump compat for Bijectors to 0.16 for package test, (keep existing compat) (#2831) (@github-actions[bot])
  • CompatHelper: bump compat for DynamicPPL to 0.42, (keep existing compat) (#2832) (@github-actions[bot])
  • CompatHelper: bump compat for DynamicPPL to 0.42 for package test, (keep existing compat) (#2833) (@github-actions[bot])
  • CompatHelper: bump compat for StatsFuns to 2, (keep existing compat) (#2834) (@github-actions[bot])
  • CompatHelper: bump compat for StatsFuns to 2 for package test, (keep existing compat) (#2835) (@github-actions[bot])
  • CompatHelper: bump compat for OrderedCollections to 2, (keep existing compat) (#2836) (@github-actions[bot])
  • Replace CompatHelper with Dependabot (#2838) (@shravangoswami-bot)
  • Bump the all-github-actions-packages group with 4 updates (#2839) (@dependabot[bot])
  • Bump codecov/codecov-action from 6 to 7 in the all-github-actions-packages group across 1 directory (#2841) (@dependabot[bot])
  • skip codecov upload on Dependabot PRs (#2843) (@shravangoswami-bot)
  • Bump actions/checkout from 6 to 7 in the all-github-actions-packages group (#2845) (@dependabot[bot])
  • Release 0.46.0 (#2846) (@shravanngoswamii)

Closed issues:

  • Add support for CategoricalArrays as inputs into a model (#1815)
  • Some useful additions to documentations (#1829)
  • Feature request: Automatically handle errors by rejecting proposal (#1891)
  • Expose all DynamicHMC configuration options in DynamicNUTS (#1938)
  • Missing RJMCMC (reversible-jump) sampler (#2023)
  • How to interface with Turing.jl @model definitions? (#2138)
  • Wishart priors resulting in PosDefException: matrix is not positive definite; Cholesky factorization failed (#2188)
  • Problem with using predict with vector valued random variables (#2239)
  • Constrained or partitioned inference for Turing models. (#2249)
  • Distributions defined in Turing: is the plan to keep them here? (#2298)
  • Interface for specifying adjoints of FEM models (#2303)
  • PDMat error when sampling from prior of model with LKJCholesky (#2316)
  • Replace @inferred tests with Jet (#2319)
  • Use AllocCheck.jl in tests (#2320)
  • Systematically dealing with TODOs (#2362)
  • Tutorial on Turing.jl and performance (#2415)
  • Gibbs doesn't work with NUTS (#2520)
  • Implement quantile(model(), u)? (#2525)
  • Online sampling for state-space models (#2531)
  • Support for point processes? (#2594)
  • Can we improve TTFX with precompilation? (#2646)
  • Stop re-exporting all of Distributions (#2682)
  • Command-line interface to Turing (#2737)
  • Version detection (#2741)
  • Add support for Parallel across the sequence MCMC algorithms (#2823)
  • Nested submodels slow down sampling (#2844)

v0.45.0

Choose a tag to compare

@github-actions github-actions released this 02 May 20:18
18eedab

Turing v0.45.0

Diff since v0.44.5

Breaking changes

Make FlexiChains the default chain type for MCMC sampling.

MCMCChains is still fully supported: you can specify chain_type=MCMCChains.Chains in the sample function to use it instead.
However, it is no longer loaded as a dependency of Turing and re-exported (it is now an extension).
That means that if you were previously importing MCMCChains via Turing, you will now have to import it directly.

Merged pull requests:

Closed issues:

  • Rework sample() call stack to use LogDensityFunction (#2555)