code: def _fit_seasonal_model_with_gibbs_sampling(
      observed_time_series,
      seasonal_structure,
      num_warmup_steps=50,
      num_results=100,
      seed=None,
  ):
      """Builds a seasonality-as-regression model and fits it by Gibbs sampling."""
      with tf.name_scope("fit_seasonal_model_with_gibbs_sampling"):
          observed_time_series = (
              sts_util.canonicalize_observed_time_series_with_mask(
                  observed_time_series
              )
          )
          dtype = observed_time_series.time_series.dtype
          design_matrix = seasonality_util.build_fixed_effects(
              num_steps=ps.shape(observed_time_series.time_series)[-2],
              seasonal_structure=seasonal_structure,
              dtype=dtype,
          )
  
          # Default priors.
          # pylint: disable=protected-access
          one = tf.ones([], dtype=dtype)
          level_variance_prior = inverse_gamma.InverseGamma(
              concentration=16, scale=16.0 * 0.001**2 * one
          )
          level_variance_prior._upper_bound = one
          slope_variance_prior = inverse_gamma.InverseGamma(
              concentration=16, scale=16.0 * 0.05**2 * one
          )
          slope_variance_prior._upper_bound = 0.01 * one
          observation_noise_variance_prior = inverse_gamma.InverseGamma(
              concentration=0.05, scale=0.05 * one
          )
          observation_noise_variance_prior._upper_bound = 1.2 * one
          # pylint: enable=protected-access
  
      model = gibbs_sampler.build_model_for_gibbs_fitting(
          observed_time_series=observed_time_series,
          design_matrix=design_matrix,
          weights_prior=normal.Normal(loc=0.0, scale=one),
          level_variance_prior=level_variance_prior,
          slope_variance_prior=slope_variance_prior,
          observation_noise_variance_prior=observation_noise_variance_prior,
      )
      return [
          model,
          gibbs_sampler.fit_with_gibbs_sampling(
              model,
              observed_time_series,
              num_results=num_results,
              num_warmup_steps=num_warmup_steps,
              seed=seed,
          ),
      ]
  
imports: import collections
  import datetime
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import inverse_gamma
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.experimental.sts_gibbs import gibbs_sampler
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.math import root_search
  from tensorflow_probability.python.sts import default_model
  from tensorflow_probability.python.sts import regularization
  from tensorflow_probability.python.sts.forecast import one_step_predictive
  from tensorflow_probability.python.sts.internal import seasonality_util
  from tensorflow_probability.python.sts.internal import util
label_desc: Use image node_id 3 for calling a global function with example usage: _fit_seasonal_model_with_gibbs_sampling(observed_time_series, seasonal_structure, num_warmup_steps, num_results, seed) and returns: list