Closed HarrisonWilde closed 1 year ago
@HarrisonWilde Is this still needed, given recent changes?
Yeah definitely not, just keeping around the draft as we incorporate the changes that it proposed (still not fully there)
On 21 Mar 2023, at 20:05, Hong Ge @.***> wrote:
@HarrisonWildehttps://github.com/HarrisonWilde Is this still needed, given recent changes?
— Reply to this email directly, view it on GitHubhttps://github.com/TuringLang/MCMCTempering.jl/pull/140#issuecomment-1478512293, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AIQUYBAZPH6CCXCKXJ4YPQTW5ICZFANCNFSM6AAAAAAU6F2I4A. You are receiving this because you were mentioned.Message ID: @.***>
The main contributions of this PR are:
chain_to_process
andprocess_to_chain
maps to instead keep chaini
's states and samplers easily accessible viastate.internal[i], sampler.internal[i]
and only manage mappings for the inverse temperature (inverse_temperatures[j]
) currently acting to temper chaini
viachain_order[j] = i
and the temperature itself being accessible viachain_to_inverse_temperature_map[i]
. This simplifies the structure of theTemperedState
significantly and should make parallelised and distributed work more simple in the future.inverse_temperatures
(is_stale
) keeping track of when this happens during astep
.swap
phase of a step with the step itself: rather than having some steps returned toAbstractMCMC.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.SingleSwap
is a more clear renaming of the previousStandardSwap
, we now provide correct implementations ofSingleRandomSwap
,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.TODO
markers in the code have been resolved, including the handling of adaptation configuration in the sampler, the top level stuff is now in the sampler and theAdaptationState
is only initiated and stored when theTemperedState
is first initialised. Additionally, the flag to turn adaptation has been removed in favour of aNoAdapt()
schedule to turn off all adaptation.swapping.jl
file to only supportLogDensityProblems
and equivalent implementations ofMCMCTempering
for now, mainly through removing the versions of functions likecompute_tempered_likelihoods
with extra unused arguments, this stuff may now be fully redundant givenTuring.jl
's support ofLogDensityProblems
. Additionally, update fromk
toi
andj
indexing to support a more general swap not necessarily between two neighbouring chains, in general this allows for clearer variable naming and reference.chain_type
arg to directly return anMCMCChains.Chains
object for example rather than making a userbundle_samples
manuallyPENDING TODO:
get_fresh_transition
as clear as possible, didn't want to over-explain that part but would appreciate second opinions.FUTURE:
ConcreteStructs