Closed HarrisonWilde closed 1 year ago
Merged the swap move part of a step with the step itself:
I'm confused; where is this happening? I'll have a closer look later; might have just missed it on the first viewing.
LGTM! Just need to make sure tests are passing. You all good locally? I'll set up Github actions with CI in a PR now.
All passing on my end other than the final MH one for the Turing model
Contributions:
Merged the swap move part of a step with the step itself:Rather than having some steps returned byAbstractMCMC.sample
that correspond only to the result of swapping temperatures between chains, we carry out the check for whether weshould_swap
and do theswap
itself as part of theAbstractMCMC.step
and always progress the chains using the underlying exploratory samplers / kernels as well, this leads to a 1:1 correspondence betweennsamples
specified at sample time and the total number of steps taken by the samplers, which is desirable.SingleRandomSwap
,RandomSwap
,ReversibleSwap
andNonReversibleSwap
in line with their definitions in the referenced literature. Reversible and Non-Reversible schemes are particularly important for reasonable baseline performance of a functional PT package, as they increase our robustness to untuned temperature ladders.StandardSwap
toSingleSwap
for clarity.NoSwap
for debugging / disabling of swap functionality.swapping.jl
:i
andj
inverse temperature indices to do a swap between.swap_attempt
(we weren't using thetotal_steps
functions in adaptation anyway, unless I am missing something?)RandomSwap
andSingleRandomSwap
, due to them involving swaps between non-neighbouring chains. Worth noting it doesnt seem to work well in general currently. Have added a check and raise for the situation where user tries to adapt under these strategies.Pending TODO:
swapping.jl
by renaming the variables ending in_other
, potentially remove the versions of functions that take many args given we are explicitly supportingLogDensityProblems
as a base for most of we want to do for now, could add back more complex signatures for things likecompute_tempered_logdensities
if required down the line.