View source on GitHub |
Deterministic minimum error resampler for sequential Monte Carlo.
tfp.experimental.mcmc.resample_deterministic_minimum_error(
log_probs,
event_size,
sample_shape,
seed=None,
name='resample_deterministic_minimum_error'
)
The return value of this function is similar to sampling with
expanded_sample_shape = tf.concat([sample_shape, [event_size]]), axis=-1)
tfd.Categorical(logits=log_probs).sample(expanded_sample_shape)`
but with values chosen deterministically so that the empirical distribution
is as close as possible to the specified distribution.
(Note that the empirical distribution can only exactly equal the requested
distribution if multiplying every probability by event_size
gives
an integer. So in general this is a biased "sampler".)
It is intended to provide a good representative sample, suitable for use
with some Sequential Monte Carlo algorithms.
This function is based on Algorithm #3 in [Maskell et al. (2006)][1].
Returns | |
---|---|
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