This method computes the posterior marginals p(latent state | observations),
given the time series at observed timesteps (a missingness mask should
be specified using tfp.sts.MaskedTimeSeries). It pushes this posterior back
through the observation model to impute a predictive distribution on the
observed time series. At unobserved steps, this is an imputed value; at other
steps it is interpreted as the model's estimate of the underlying noise-free
floatTensor of shape
concat([sample_shape, model.batch_shape, [num_timesteps, 1]]) where
sample_shape corresponds to i.i.d. observations, and the trailing 
dimension may (optionally) be omitted if num_timesteps > 1. Any NaNs
are interpreted as missing observations; missingness may be also be
explicitly specified by passing a tfp.sts.MaskedTimeSeries instance.
Python list of Tensors representing posterior
samples of model parameters, with shapes [concat([
param.prior.event_shape]) for param in model.parameters]. This may
optionally also be a map (Python dict) of parameter names to
If False, the imputed uncertainties
represent the model's estimate of the noise-free time series at each
timestep. If True, they represent the model's estimate of the range of
values that could be observed at each timestep, including any i.i.d.
Default value: False.
Deprecated, for backwards compatibility only.
If False, the predictive distribution will return per-timestep
Default value: True.
a tfd.MixtureSameFamily instance with event shape
[num_timesteps] if timesteps_are_event_shape else  and
batch shape concat([sample_shape, model.batch_shape,
 if timesteps_are_event_shape else [num_timesteps]), with
num_posterior_draws mixture components.
Masked time series can be passed to tfp.sts methods in place of a
# Build model using observed time series to set heuristic priors.
linear_trend_model = tfp.sts.LocalLinearTrend(
model = tfp.sts.Sum([linear_trend_model],
# Fit model to data
parameter_samples, _ = tfp.sts.fit_with_hmc(model, observed_time_series)
After fitting a model, impute_missing_values will return a distribution
# Impute missing values
imputed_series_distribution = tfp.sts.impute_missing_values(
model, observed_time_series, parameter_samples=parameter_samples)
print('imputed means and stddevs: ',