Thin kernel and sampling algorithm #791
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR discussed in #738
Add SamplingAlgorithm and kernel transformations making them thinned. They take a
thinning
integer and a SamplingAlgorithm/kernel and return the same SamplingAlgorithm/kernel but iteratedthinning
times.This is useful to reduce computation and memory cost of high throughput samplers, especially in high dimension. While the
thin_algorithm
function operates on top_level_api SamplingAlgorithm, thethin_kernel
version is relevant for adaptation algorithms. For instance, the estimation of autocorrelation length, for tuning momentum decoherence length inmclmc_adaptation
, using the states from every step is computationally prohibitive in high dimension, see Subsampling for MCLMC tuning #738.Both transformations have an additional
info_transform
Callable parameter that defines how to aggregate the sampler informations across thethinning
steps. For instance, we might want to average the logdensities, and to rootmeansquare the energy_changes, which can be easily performed withtree.map
ortree.map_with_path
.main
commit;pre-commit
is installed and configured on your machine, and you ran it before opening the PR;