tfp.experimental.sts_gibbs.fit_with_gibbs_sampling
Stay organized with collections
Save and categorize content based on your preferences.
Fits parameters for an STS model using Gibbs sampling.
tfp.experimental.sts_gibbs.fit_with_gibbs_sampling(
model,
observed_time_series,
num_chains=(),
num_results=2000,
num_warmup_steps=200,
initial_state=None,
seed=None,
default_pseudo_observations=None,
experimental_use_dynamic_cholesky=False,
experimental_use_weight_adjustment=False
)
Args |
model
|
A tfp.sts.StructuralTimeSeries model instance return by
build_model_for_gibbs_fitting .
|
observed_time_series
|
float Tensor of shape [..., T, 1](omitting the
trailing unit dimension is also supported when T > 1), specifying an
observed time series. May optionally be an instance of
<a href="../../../tfp/sts/MaskedTimeSeries"><code>tfp.sts.MaskedTimeSeries</code></a>, which includes a mask Tensorto specify
timesteps with missing observations.
</td>
</tr><tr>
<td> num_chains<a id="num_chains"></a>
</td>
<td>
Optional int to indicate the number of parallel MCMC chains.
Default to an empty tuple to sample a single chain.
</td>
</tr><tr>
<td> num_results<a id="num_results"></a>
</td>
<td>
Optional int to indicate number of MCMC samples.
</td>
</tr><tr>
<td> num_warmup_steps<a id="num_warmup_steps"></a>
</td>
<td>
Optional int to indicate number of MCMC samples.
</td>
</tr><tr>
<td> initial_state<a id="initial_state"></a>
</td>
<td>
A GibbsSamplerStatestructure of the initial states of the
MCMC chains.
</td>
</tr><tr>
<td> seed<a id="seed"></a>
</td>
<td>
Optional Python intseed controlling the sampled values.
</td>
</tr><tr>
<td> default_pseudo_observations<a id="default_pseudo_observations"></a>
</td>
<td>
Optional scalar float TensorControls the
number of pseudo-observations for the prior precision matrix over the
weights.
</td>
</tr><tr>
<td> experimental_use_dynamic_cholesky<a id="experimental_use_dynamic_cholesky"></a>
</td>
<td>
Optional bool - in case of spike and slab
sampling, will dynamically select the subset of the design matrix with
active features to perform the Cholesky decomposition. This may provide
a speedup when the number of true features is small compared to the size
of the design matrix. *Note*: If this is true, neither batch shape nor jit_compileis supported.
</td>
</tr><tr>
<td> experimental_use_weight_adjustment`
|
Optional bool - use a nonstandard
update for the posterior precision of the weight in case of a spike and
slab sampler.
|
Returns |
model
|
A GibbsSamplerState structure of posterior samples.
|
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.
[null,null,["Last updated 2023-11-21 UTC."],[],[],null,["# tfp.experimental.sts_gibbs.fit_with_gibbs_sampling\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/python/experimental/sts_gibbs/gibbs_sampler.py#L428-L539) |\n\nFits parameters for an STS model using Gibbs sampling. \n\n tfp.experimental.sts_gibbs.fit_with_gibbs_sampling(\n model,\n observed_time_series,\n num_chains=(),\n num_results=2000,\n num_warmup_steps=200,\n initial_state=None,\n seed=None,\n default_pseudo_observations=None,\n experimental_use_dynamic_cholesky=False,\n experimental_use_weight_adjustment=False\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|\n| `model` | A [`tfp.sts.StructuralTimeSeries`](../../../tfp/sts/StructuralTimeSeries) model instance return by `build_model_for_gibbs_fitting`. |\n| `observed_time_series` | `float` `Tensor` of shape \\[..., T, 1\\]`(omitting the trailing unit dimension is also supported when`T \\\u003e 1`), specifying an observed time series. May optionally be an instance of \u003ca href=\"../../../tfp/sts/MaskedTimeSeries\"\u003e\u003ccode\u003etfp.sts.MaskedTimeSeries\u003c/code\u003e\u003c/a\u003e, which includes a mask`Tensor`to specify timesteps with missing observations. \u003c/td\u003e \u003c/tr\u003e\u003ctr\u003e \u003ctd\u003e`num_chains`\u003ca id=\"num_chains\"\u003e\u003c/a\u003e \u003c/td\u003e \u003ctd\u003e Optional int to indicate the number of parallel MCMC chains. Default to an empty tuple to sample a single chain. \u003c/td\u003e \u003c/tr\u003e\u003ctr\u003e \u003ctd\u003e`num_results`\u003ca id=\"num_results\"\u003e\u003c/a\u003e \u003c/td\u003e \u003ctd\u003e Optional int to indicate number of MCMC samples. \u003c/td\u003e \u003c/tr\u003e\u003ctr\u003e \u003ctd\u003e`num_warmup_steps`\u003ca id=\"num_warmup_steps\"\u003e\u003c/a\u003e \u003c/td\u003e \u003ctd\u003e Optional int to indicate number of MCMC samples. \u003c/td\u003e \u003c/tr\u003e\u003ctr\u003e \u003ctd\u003e`initial_state`\u003ca id=\"initial_state\"\u003e\u003c/a\u003e \u003c/td\u003e \u003ctd\u003e A`GibbsSamplerState`structure of the initial states of the MCMC chains. \u003c/td\u003e \u003c/tr\u003e\u003ctr\u003e \u003ctd\u003e`seed`\u003ca id=\"seed\"\u003e\u003c/a\u003e \u003c/td\u003e \u003ctd\u003e Optional`Pythonint`seed controlling the sampled values. \u003c/td\u003e \u003c/tr\u003e\u003ctr\u003e \u003ctd\u003e`default_pseudo_observations`\u003ca id=\"default_pseudo_observations\"\u003e\u003c/a\u003e \u003c/td\u003e \u003ctd\u003e Optional scalar float`Tensor`Controls the number of pseudo-observations for the prior precision matrix over the weights. \u003c/td\u003e \u003c/tr\u003e\u003ctr\u003e \u003ctd\u003e`experimental_use_dynamic_cholesky`\u003ca id=\"experimental_use_dynamic_cholesky\"\u003e\u003c/a\u003e \u003c/td\u003e \u003ctd\u003e Optional bool - in case of spike and slab sampling, will dynamically select the subset of the design matrix with active features to perform the Cholesky decomposition. This may provide a speedup when the number of true features is small compared to the size of the design matrix. *Note*: If this is true, neither batch shape nor`jit_compile`is supported. \u003c/td\u003e \u003c/tr\u003e\u003ctr\u003e \u003ctd\u003e`experimental_use_weight_adjustment\\` | Optional bool - use a nonstandard update for the posterior precision of the weight in case of a spike and slab sampler. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---------|-------------------------------------------------------|\n| `model` | A `GibbsSamplerState` structure of posterior samples. |\n\n\u003cbr /\u003e"]]