tfp.experimental.sts_gibbs.one_step_predictive

Constructs a one-step-ahead predictive distribution at every timestep.

Unlike the generic tfp.sts.one_step_predictive, this method uses the latent levels from Gibbs sampling to efficiently construct a predictive distribution that mixes over posterior samples. The predictive distribution may also include additional forecast steps.

This method returns the predictive distributions for each timestep given previous timesteps and sampled model parameters, p(observed_time_series[t] | observed_time_series[:t], weights, observation_noise_scale). Note that the posterior values of the weights and noise scale will in general be informed by observations from all timesteps including the step being predicted, so this is not a strictly kosher probabilistic quantity, but in general we assume that it's close, i.e., that the step being predicted had very small individual impact on the overall parameter posterior.

model A tfd.sts.StructuralTimeSeries model instance. This must be of the form constructed by build_model_for_gibbs_sampling.
posterior_samples A GibbsSamplerState instance in which each element is a Tensor with initial dimension of size num_samples.
num_forecast_steps Python int number of additional forecast steps to append. Default value: 0.
original_mean Optional scalar float Tensor, added to the predictive distribution to undo the effect of input normalization. Default value: 0.
original_scale Optional scalar float Tensor, used to rescale the predictive distribution to undo the effect of input normalization. Default value: 1.
thin_every Optional Python int factor by which to thin the posterior samples, to reduce complexity of the predictive distribution. For example, if thin_every=10, every 10th sample will be used. Default value: 1.
use_zero_step_prediction If true, instead of using the local level and trend from the timestep before, just use the local level from the same timestep.

predictive_dist A tfd.MixtureSameFamily instance of event shape [num_timesteps + num_forecast_steps] representing the predictive distribution of each timestep given previous timesteps.