tfp.experimental.mcmc.resample_stratified

View source on GitHub

Stratified resampler for sequential Monte Carlo.

The value returned from this algorithm is similar to sampling with

expanded_sample_shape = tf.concat([[event_size], sample_shape]), axis=-1)
tfd.Categorical(logits=log_probs).sample(expanded_sample_shape)`

but with values sorted along the first axis. It can be considered to be sampling events made up of a length-event_size vector of draws from the Categorical distribution. However, although the elements of this event have the appropriate marginal distribution, they are not independent of each other. Instead they are drawn using a low variance stratified sampling method suitable for use with Sequential Monte Carlo algorithms. The sortedness is an unintended side effect of the algorithm that is harmless in the context of simple SMC algorithms.

This function is based on Algorithm #1 in the paper [Maskell et al. (2006)][1].

log_probs A tensor-valued batch of discrete log probability distributions.
event_size the dimension of the vector considered a single draw.
sample_shape the sample_shape determining the number of draws.
seed Python 'int used to seed calls to tf.random.*. Default value: None (i.e. no seed).
name Python str name for ops created by this method. Default value: None (i.e., 'resample_independent').

resampled_indices a tensor of samples.

References

[1]: S. Maskell, B. Alun-Jones and M. Macleod. A Single Instruction Multiple Data Particle Filter. In 2006 IEEE Nonlinear Statistical Signal Processing Workshop. http://people.ds.cam.ac.uk/fanf2/hermes/doc/antiforgery/stats.pdf