0.36.0 introduces a new Gibbs sampler. It's been included in several previous releases as Turing.Experimental.Gibbs
, but now takes over the old Gibbs sampler, which gets removed completely.
The new Gibbs sampler supports the same user-facing interface as the old one. However, given that the internals of it having been completely rewritten in a very different manner, there may be accidental breakage that we haven't anticipated. Please report any you find.
GibbsConditional
has also been removed. It was never very user-facing, but it was exported, so technically this is breaking.
The old Gibbs constructor relied on being called with several subsamplers, and each of the constructors of the subsamplers would take as arguments the symbols for the variables that they are to sample, e.g. Gibbs(HMC(:x), MH(:y))
. This constructor has been deprecated, and will be removed in the future. The new constructor works by assigning samplers to either symbols or VarNames
, e.g. Gibbs(; x=HMC(), y=MH())
or Gibbs(@varname(x) => HMC(), @varname(y) => MH())
. This allows more granular specification of which sampler to use for which variable.
Likewise, the old constructor for calling one subsampler more often than another, Gibbs((HMC(0.01, 4, :x), 2), (MH(:y), 1))
has been deprecated. The new way to do this is to use RepeatSampler
, also introduced at this version: Gibbs(@varname(x) => RepeatSampler(HMC(0.01, 4), 2), @varname(y) => MH())
.
Julia 1.10 is now the minimum required version for Turing.
Tapir.jl has been removed and replaced with its successor, Mooncake.jl.
You can use Mooncake.jl by passing adbackend=AutoMooncake(; config=nothing)
to the relevant samplers.
Support for Tracker.jl as an AD backend has been removed.
The following exported functions have been removed:
constrained_space
get_parameter_bounds
optim_objective
optim_function
optim_problem
The same functionality is now offered by the new exported functions
maximum_likelihood
maximum_a_posteriori
essential/ad.jl
is removed,ForwardDiff
andReverseDiff
integrations viaLogDensityProblemsAD
are moved toDynamicPPL
and live in corresponding package extensions.LogDensityProblemsAD.ADgradient(ℓ::DynamicPPL.LogDensityFunction)
(i.e. the single argument method) is moved toInference
module. It will createADgradient
using theadtype
information stored incontext
field ofℓ
.getADbackend
function is renamed togetADType
, the interface is preserved, but packages that previously usedgetADbackend
should be updated to usegetADType
.TuringTag
for ForwardDiff is also removed, nowDynamicPPLTag
is defined inDynamicPPL
package and should serve the same purpose.
ADTypes.jl
replaced Turing's global AD backend. Users should now specify the desiredADType
directly in sampler constructors, e.g.,HMC(0.1, 10; adtype=AutoForwardDiff(; chunksize))
, orHMC(0.1, 10; adtype=AutoReverseDiff(false))
(false
indicates not to use compiled tape).- Interface functions such as
ADBackend
,setadbackend
,setadsafe
,setchunksize
, andsetrdcache
are deprecated and will be removed in a future release. - Removed the outdated
verifygrad
function. - Updated to a newer version of
LogDensityProblemsAD
(v1.7).
- The interface for defining new distributions with constrained support and making them compatible with
Turing
has changed. To make a custom distribution typeCustomDistribution
compatible withTuring
, the user needs to define the methodbijector(d::CustomDistribution)
that returns an instance of typeBijector
implementing theBijectors.Bijector
API. ~
is now thread-safe when used for observations, but not assumptions (non-observed model parameters) yet.- There were some performance improvements in the automatic differentiation (AD) of functions in
DistributionsAD
andBijectors
, leading to speeds closer to and sometimes faster than Stan's. - An
HMC
initialization bug was fixed.HMC
initialization in Turing is now consistent with Stan's. - Sampling from the prior is now possible using
sample
. psample
is now deprecated in favour ofsample(model, sampler, parallel_method, n_samples, n_chains)
whereparallel_method
can be eitherMCMCThreads()
orMCMCDistributed()
.MCMCThreads
will use your available threads to sample each chain (ensure that you have the environment variableJULIA_NUM_THREADS
set to the number of threads you want to use), andMCMCDistributed
will dispatch chain sampling to each available process (you can add processes withaddprocs()
).- Turing now uses
AdvancedMH.jl
v0.5, which mostly provides behind-the-scenes restructuring. - Custom expressions and macros can be interpolated in the
@model
definition with$
; it is possible to use@.
also for assumptions (non-observed model parameters) and observations. - The macros
@varinfo
,@logpdf
, and@sampler
are removed. Instead, one can access the internal variables_varinfo
,_model
,_sampler
, and_context
in the@model
definition. - Additional constructors for
SMC
andPG
make it easier to choose the resampling method and threshold.
- Removed some extraneous imports and dependencies (#1182)
- Minor backend changes to
sample
andpsample
, which now use functions defined upstream in AbstractMCMC.jl (#1187) - Fix for an AD-related crash (#1202)
- StatsBase compat update to 0.33 (#1185)
- Bugfix for ReverseDiff caching and memoization (#1208)
- BREAKING:
VecBinomialLogit
is now removed. AlsoBernoulliLogit
is added (#1214) - Bugfix for cases where dynamic models were breaking with HMC methods (#1217)
- Updates to allow AdvancedHMC 0.2.23 (#1218)
- Add more informative error messages for SMC (#900)
- Fix bug where arrays with mixed integers, floats, and missing values were not being passed to the
MCMCChains.Chains
constructor properly #1180.
- Update elliptical slice sampling to use EllipticalSliceSampling.jl on the backend. #1145. Nothing should change from a front-end perspective -- you can still call
sample(model, ESS(), 1000)
. - Added default progress loggers in #1149.
- The symbols used to define the AD backend have changed to be the lowercase form of the package name used for AD.
forward_diff
is nowforwarddiff
,reverse_diff
is nowtracker
, andzygote
andreversediff
are newly supported (see below).forward_diff
andreverse_diff
are deprecated and are slated to be removed. - Turing now has experimental support for Zygote.jl (#783) and ReverseDiff.jl (#1170) AD backends. Both backends are experimental, so please report any bugs you find. Zygote does not allow mutation within your model, so please be aware of this issue. You can enable Zygote with
Turing.setadbackend(:zygote)
and you can enable ReverseDiff withTuring.setadbackend(:reversediff)
, though to use either you must import the package withusing Zygote
orusing ReverseDiff
.for
loops are not recommended for ReverseDiff or Zygote -- see performance tips for more information. - Fix MH indexing bug #1135.
- Fix MH array sampling #1167.
- Fix bug in VI where the bijectors where being inverted incorrectly #1168.
- The Gibbs sampler handles state better by passing
Transition
structs to the local samplers (#1169 and #1166).
- Fix compatibility with Julia 0.6 [#341, #330, #293]
- Support of Stan interface [#343, #326]
- Fix Binomial distribution for gradients. [#311]
- Stochastic gradient Hamiltonian Monte Carlo [#201]; Stochastic gradient Langevin dynamics [#27]
- More particle MCMC family samplers: PIMH & PMMH [#364, #369]
- Disable adaptive resampling for CSMC [#357]
- Fix resampler for SMC [#338]
- Interactive particle MCMC [#334]
- Add type alias CSMC for PG [#333]
- Fix progress meter [#317]
- NUTS implementation #188
- HMC: Transforms of ϵ for each variable #67 (replace with introducing mass matrix)
- Finish: Sampler (internal) interface design #107
- Substantially improve performance of HMC and Gibbs #7
- Vectorising likelihood computations #117 #255
- Remove obsolete
randoc
,randc
? #156 - Support truncated distribution. #87
- Refactoring code: Unify VarInfo, Trace, TaskLocalStorage #96
- Refactoring code: Better gradient interface #97
- Gibbs sampler ([#73])
- HMC for constrained variables ([#66]; no support for varying dimensions)
- Added support for
Mamba.Chain
([#90]): describe, plot etc. - New interface design ([#55]), ([#104])
- Bugfixes and general improvements (e.g.
VarInfo
[#96])
- Initial support for Hamiltonian Monte Carlo (no support for discrete/constrained variables)
- Require Julia 0.5
- Bugfixes and general improvements
The initial releases of Turing.
- Particle MCMC, SMC, IS
- Implemented copying for Julia Task
- Implemented copy-on-write data structure
TArray
for Tasks