code: def _build_test_model(
      self,
      num_timesteps=5,
      num_features=2,
      batch_shape=(),
      missing_prob=0,
      true_noise_scale=0.1,
      true_level_scale=0.04,
      true_slope_scale=0.02,
      prior_class=inverse_gamma.InverseGamma,
      weights=None,
      weights_prior_scale=10.0,
      sparse_weights_nonzero_prob=None,
      time_series_shift=0.0,
      dtype=tf.float32,
      design_matrix=False,
      seed=None,
      seasonal_components=None,
      tiled_residual_offset=None,
  ):
      if seasonal_components is None:
          seasonal_components = []
      if seed is None:
          seed = test_util.test_seed(sampler_type="stateless")
      (
          design_seed,
          weights_seed,
          noise_seed,
          level_seed,
          slope_seed,
          is_missing_seed,
      ) = samplers.split_seed(seed, 6, salt="_build_test_model")
  
      if weights is None:
          weights = samplers.normal(
              list(batch_shape) + [num_features],
              dtype=dtype,
              seed=weights_seed,
          )
      if design_matrix is None:
          reg = tf.zeros(num_timesteps, dtype)
      else:
          if isinstance(design_matrix, bool) and not design_matrix:
              design_matrix = samplers.normal(
                  [num_timesteps, num_features],
                  dtype=dtype,
                  seed=design_seed,
              )
          reg = tf.linalg.matvec(design_matrix, weights)
      noise = (
          samplers.normal(
              list(batch_shape) + [num_timesteps],
              dtype=dtype,
              seed=noise_seed,
          )
          * true_noise_scale
      )
  
      level_residuals = (
          samplers.normal(
              list(batch_shape) + [num_timesteps],
              dtype=dtype,
              seed=level_seed,
          )
          * true_level_scale
      )
      if true_slope_scale is not None:
          slope = tf.cumsum(
              samplers.normal(
                  list(batch_shape) + [num_timesteps],
                  dtype=dtype,
                  seed=slope_seed,
              )
              * true_slope_scale,
              axis=-1,
          )
          level_residuals += slope
      level = tf.cumsum(level_residuals, axis=-1)
  
      residual_offset = 0.0
      if tiled_residual_offset:
          residual_offset = tf.convert_to_tensor(
              [
                  tiled_residual_offset[x % len(tiled_residual_offset)]
                  for x in range(num_timesteps)
              ]
          )
  
      time_series = (
          reg + noise + level + time_series_shift + residual_offset
      )
      is_missing = (
          samplers.uniform(
              list(batch_shape) + [num_timesteps],
              dtype=dtype,
              seed=is_missing_seed,
          )
          < missing_prob
      )
  
      observation_noise_variance_prior = prior_class(
          concentration=tf.cast(0.01, dtype),
          scale=tf.cast(0.01 * 0.01, dtype),
      )
      observation_noise_variance_prior.upper_bound = tf.constant(
          100.0, dtype=dtype
      )
  
      observed_time_series = missing_values_util.MaskedTimeSeries(
          time_series[..., tf.newaxis], is_missing
      )
      if time_series_shift != 0.0:
          (
              observed_mean,
              observed_stddev,
              observed_initial,
          ) = sts_util.empirical_statistics(observed_time_series)
          initial_level_prior = normal.Normal(
              loc=observed_mean + observed_initial,
              scale=tf.abs(observed_initial) + observed_stddev,
          )
      else:
          initial_level_prior = None
  
      model = gibbs_sampler.build_model_for_gibbs_fitting(
          observed_time_series=observed_time_series,
          design_matrix=design_matrix,
          weights_prior=(
              None
              if weights_prior_scale is None
              else normal.Normal(
                  loc=tf.cast(0.0, dtype),
                  scale=tf.cast(weights_prior_scale, dtype),
              )
          ),
          level_variance_prior=prior_class(
              concentration=tf.cast(0.01, dtype),
              scale=tf.cast(0.01 * 0.01, dtype),
          ),
          slope_variance_prior=None
          if true_slope_scale is None
          else prior_class(
              concentration=tf.cast(0.01, dtype),
              scale=tf.cast(0.01 * 0.01, dtype),
          ),
          initial_level_prior=initial_level_prior,
          observation_noise_variance_prior=observation_noise_variance_prior,
          sparse_weights_nonzero_prob=sparse_weights_nonzero_prob,
          seasonal_components=seasonal_components,
      )
      return model, time_series, is_missing
  
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import identity
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.bijectors import square
  from tensorflow_probability.python.distributions import inverse_gamma
  from tensorflow_probability.python.distributions import lognormal
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import student_t
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.distributions.linear_gaussian_ssm import linear_gaussian_update
  from tensorflow_probability.python.experimental.distributions import mvn_precision_factor_linop
  from tensorflow_probability.python.experimental.sts_gibbs import gibbs_sampler
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.stats import sample_stats
  from tensorflow_probability.python.sts.components import local_level
  from tensorflow_probability.python.sts.components import local_linear_trend
  from tensorflow_probability.python.sts.components import regression
  from tensorflow_probability.python.sts.components import seasonal
  from tensorflow_probability.python.sts.components import semilocal_linear_trend
  from tensorflow_probability.python.sts.components import sum
  from tensorflow_probability.python.sts.forecast import forecast
  from tensorflow_probability.python.sts.internal import missing_values_util
  from tensorflow_probability.python.sts.internal import util
label_desc: Use image node_id 1 for calling the GibbsSamplerTests obj's underlying member method code with example usage: obj._build_test_model(num_timesteps, num_features, batch_shape, missing_prob, true_noise_scale, true_level_scale, true_slope_scale, prior_class, weights, weights_prior_scale, sparse_weights_nonzero_prob, time_series_shift, dtype, design_matrix, seed, seasonal_components, tiled_residual_offset) and returns: model,  time_series,  is_missing