<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/probability/blob/v0.25.0/tensorflow_probability/python/experimental/mcmc/sample_discarding_kernel.py#L40-L173) |

Appropriately discards samples to conduct thinning and burn-in.

Inherits From: [`TransitionKernel`](https://www.tensorflow.org/probability/api_docs/python/tfp/mcmc/TransitionKernel)

    tfp.experimental.mcmc.SampleDiscardingKernel(
        inner_kernel, num_burnin_steps=0, num_steps_between_results=0, name=None
    )

`SampleDiscardingKernel` is a composable `TransitionKernel` that
applies thinning and burn-in to samples returned by its
`inner_kernel`. All Transition Kernels wrapping it will only
see non-discarded samples.

The burn-in step conducts both burn-in and one step of thinning.
In other words, the first call to `one_step` will skip
`num_burnin_steps + num_steps_between_results` samples. All
subsequent calls skip only `num_steps_between_results` samples.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `inner_kernel` | `TransitionKernel` whose `one_step` will generate MCMC results. |
| `num_burnin_steps` | Integer or scalar `Tensor` representing the number of chain steps to take before starting to collect results. Defaults to 0 (i.e., no burn-in). |
| `num_steps_between_results` | Integer or scalar `Tensor` representing the number of chain steps between collecting a result. Only one out of every `num_steps_between_samples + 1` steps is included in the returned results. Defaults to 0 (i.e., no thinning). |
| `name` | Python `str` name prefixed to Ops created by this function. Default value: `None` (i.e., "sample_discarding_kernel"). |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `experimental_shard_axis_names` | The shard axis names for members of the state. |
| `inner_kernel` | <br /> <br /> |
| `is_calibrated` | Returns `True` if Markov chain converges to specified distribution. <br /> `TransitionKernel`s which are "uncalibrated" are often calibrated by composing them with the [`tfp.mcmc.MetropolisHastings`](https://www.tensorflow.org/probability/api_docs/python/tfp/mcmc/MetropolisHastings) `TransitionKernel`. |
| `name` | <br /> <br /> |
| `num_burnin_steps` | <br /> <br /> |
| `num_steps_between_results` | <br /> <br /> |
| `parameters` | <br /> <br /> |

<br />

## Methods

### `bootstrap_results`

[View source](https://github.com/tensorflow/probability/blob/v0.25.0/tensorflow_probability/python/experimental/mcmc/sample_discarding_kernel.py#L130-L149)

    bootstrap_results(
        init_state, inner_results=None
    )

Instantiates a new kernel state with no calls.

<br />

<br />

<br />

| Args ||
|---|---|
| `init_state` | `Tensor` or Python `list` of `Tensor`s representing the state(s) of the Markov chain(s). |
| `inner_results` | Optional results tuple for the inner kernel. Will be re-bootstrapped if omitted. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| `kernel_results` | `collections.namedtuple` of `Tensor`s representing internal calculations made within this function. |

<br />

### `copy`

[View source](https://github.com/tensorflow/probability/blob/v0.25.0/tensorflow_probability/python/mcmc/kernel.py#L148-L164)

    copy(
        **override_parameter_kwargs
    )

Non-destructively creates a deep copy of the kernel.

<br />

<br />

<br />

| Args ||
|---|---|
| `**override_parameter_kwargs` | Python String/value `dictionary` of initialization arguments to override with new values. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| `new_kernel` | `TransitionKernel` object of same type as `self`, initialized with the union of self.parameters and override_parameter_kwargs, with any shared keys overridden by the value of override_parameter_kwargs, i.e., `dict(self.parameters, **override_parameters_kwargs)`. |

<br />

### `experimental_with_shard_axes`

[View source](https://github.com/tensorflow/probability/blob/v0.25.0/tensorflow_probability/python/mcmc/kernel.py#L136-L146)

    experimental_with_shard_axes(
        shard_axis_names
    )

Returns a copy of the kernel with the provided shard axis names.

<br />

<br />

<br />

| Args ||
|---|---|
| `shard_axis_names` | a structure of strings indicating the shard axis names for each component of this kernel's state. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A copy of the current kernel with the shard axis information. ||

<br />

### `one_step`

[View source](https://github.com/tensorflow/probability/blob/v0.25.0/tensorflow_probability/python/experimental/mcmc/sample_discarding_kernel.py#L96-L128)

    one_step(
        current_state, previous_kernel_results, seed=None
    )

Collects one non-discarded chain state.

<br />

<br />

<br />

| Args ||
|---|---|
| `current_state` | `Tensor` or Python `list` of `Tensor`s representing the current state(s) of the Markov chain(s), |
| `previous_kernel_results` | `collections.namedtuple` containing `Tensor`s representing values from previous calls to this function (or from the `bootstrap_results` function). |
| `seed` | PRNG seed; see [`tfp.random.sanitize_seed`](https://www.tensorflow.org/probability/api_docs/python/tfp/random/sanitize_seed) for details. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| `new_chain_state` | Newest non-discarded MCMC chain state drawn from the `inner_kernel`. |
| `kernel_results` | `collections.namedtuple` of internal calculations used to advance the chain. |

<br />