tfp.experimental.mcmc.resample_systematic
Stay organized with collections
Save and categorize content based on your preferences.
A systematic resampler for sequential Monte Carlo.
tfp.experimental.mcmc.resample_systematic(
log_probs, event_size, sample_shape, seed=None, name=None
)
The value returned from this function is similar to sampling with
expanded_sample_shape = tf.concat([[event_size], sample_shape]), axis=-1)
logits = dist_util.move_dimension(log_probs, source_idx=0, dest_idx=-1)
tfd.Categorical(logits=logits).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 stratified
sampling method that in some sense reduces variance and is suitable for
use with Sequential Monte Carlo algorithms as described in
[Doucet et al. (2011)][2].
The sortedness is an unintended side effect of the algorithm that is
harmless in the context of simple SMC algorithms.
This implementation is based on the algorithms in [Maskell et al. (2006)][1]
where it is called minimum variance resampling.
Args |
log_probs
|
A tensor-valued batch of discrete log probability distributions.
It is expected that those log probabilities are normalized along the
first dimension (such that sum(exp(log_probs), axis=0) == 1 ).
The remaining dimensions are batch dimensions.
|
event_size
|
the dimension of the vector considered a single draw.
|
sample_shape
|
the sample_shape determining the number of draws.
|
seed
|
PRNG seed; see tfp.random.sanitize_seed for details.
Default value: None (i.e. no seed).
|
name
|
Python str name for ops created by this method.
Default value: None (i.e., 'resample_systematic' ).
|
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
[2]: A. Doucet & A. M. Johansen. Tutorial on Particle Filtering and
Smoothing: Fifteen Years Later
In 2011 The Oxford Handbook of Nonlinear Filtering
https://www.stats.ox.ac.uk/~doucet/doucet_johansen_tutorialPF2011.pdf
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-11-21 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-11-21 UTC."],[],[],null,["# tfp.experimental.mcmc.resample_systematic\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/python/experimental/mcmc/weighted_resampling.py#L244-L313) |\n\nA systematic resampler for sequential Monte Carlo. \n\n tfp.experimental.mcmc.resample_systematic(\n log_probs, event_size, sample_shape, seed=None, name=None\n )\n\nThe value returned from this function is similar to sampling with \n\n expanded_sample_shape = tf.concat([[event_size], sample_shape]), axis=-1)\n logits = dist_util.move_dimension(log_probs, source_idx=0, dest_idx=-1)\n tfd.Categorical(logits=logits).sample(expanded_sample_shape)\n\nbut with values sorted along the first axis. It can be considered to be\nsampling events made up of a length-`event_size` vector of draws from\nthe `Categorical` distribution. However, although the elements of\nthis event have the appropriate marginal distribution, they are not\nindependent of each other. Instead they are drawn using a stratified\nsampling method that in some sense reduces variance and is suitable for\nuse with Sequential Monte Carlo algorithms as described in\n\\[Doucet et al. (2011)\\]\\[2\\].\nThe sortedness is an unintended side effect of the algorithm that is\nharmless in the context of simple SMC algorithms.\n\nThis implementation is based on the algorithms in \\[Maskell et al. (2006)\\]\\[1\\]\nwhere it is called minimum variance resampling.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `log_probs` | A tensor-valued batch of discrete log probability distributions. It is expected that those log probabilities are normalized along the first dimension (such that `sum(exp(log_probs), axis=0) == 1`). The remaining dimensions are batch dimensions. |\n| `event_size` | the dimension of the vector considered a single draw. |\n| `sample_shape` | the `sample_shape` determining the number of draws. |\n| `seed` | PRNG seed; see [`tfp.random.sanitize_seed`](../../../tfp/random/sanitize_seed) for details. Default value: None (i.e. no seed). |\n| `name` | Python `str` name for ops created by this method. Default value: `None` (i.e., `'resample_systematic'`). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---------------------|----------------------|\n| `resampled_indices` | a tensor of samples. |\n\n\u003cbr /\u003e\n\n#### References\n\n\\[1\\]: S. Maskell, B. Alun-Jones and M. Macleod. A Single Instruction Multiple\nData Particle Filter.\nIn 2006 IEEE Nonlinear Statistical Signal Processing Workshop.\n\u003chttp://people.ds.cam.ac.uk/fanf2/hermes/doc/antiforgery/stats.pdf\u003e\n\\[2\\]: A. Doucet \\& A. M. Johansen. Tutorial on Particle Filtering and\nSmoothing: Fifteen Years Later\nIn 2011 The Oxford Handbook of Nonlinear Filtering\n[https://www.stats.ox.ac.uk/\\~doucet/doucet_johansen_tutorialPF2011.pdf](https://www.stats.ox.ac.uk/~doucet/doucet_johansen_tutorialPF2011.pdf)"]]