code: def test_docstring_fitting_example(self):
      # Construct a series of eleven data points, covering a period of two weeks
      # with three missing days.
      series = pd.Series(
          [
              100.0,
              27.0,
              92.0,
              66.0,
              51.0,
              126.0,
              113.0,
              95.0,
              48.0,
              20.0,
              59.0,
          ],
          index=pd.to_datetime(
              [
                  "2020-01-01",
                  "2020-01-02",
                  "2020-01-04",
                  "2020-01-05",
                  "2020-01-06",
                  "2020-01-07",
                  "2020-01-10",
                  "2020-01-11",
                  "2020-01-12",
                  "2020-01-13",
                  "2020-01-14",
              ]
          ),
      )
      series = regularization.regularize_series(series)
      self.assertLen(series, 14)
  
      # Default model captures day-of-week effects with a LocalLinearTrend
      # baseline.
      model = default_model.build_default_model(series)
      self.assertLen(model.components, 2)
  
      # Fit the model using variational inference.
      surrogate_posterior = fitting.build_factored_surrogate_posterior(
          model
      )
      _ = optimization.fit_surrogate_posterior(
          target_log_prob_fn=model.joint_distribution(series).log_prob,
          surrogate_posterior=surrogate_posterior,
          optimizer=tf_keras.optimizers.Adam(0.1),
          num_steps=1000,
          convergence_criterion=(
              successive_gradients_are_uncorrelated.SuccessiveGradientsAreUncorrelated(
                  window_size=15, min_num_steps=50
              )
          ),
          jit_compile=True,
      )
  
      # Forecast the next week.
      parameter_samples = surrogate_posterior.sample(50)
      forecast_dist = forecast(
          model,
          observed_time_series=series,
          parameter_samples=parameter_samples,
          num_steps_forecast=7,
      )
      # Strip trailing unit dimension from LinearGaussianStateSpaceModel events.
      self.evaluate(
          [
              v.initializer
              for v in surrogate_posterior.trainable_variables
          ]
      )
      forecast_mean, forecast_stddev = self.evaluate(
          (forecast_dist.mean()[..., 0], forecast_dist.stddev()[..., 0])
      )
  
      pd.DataFrame(
          {
              "mean": forecast_mean,
              "lower_bound": forecast_mean - 2.0 * forecast_stddev,
              "upper_bound": forecast_mean + 2.0 * forecast_stddev,
          },
          index=pd.date_range(
              start=series.index[-1] + series.index.freq,
              periods=7,
              freq=series.index.freq,
          ),
      )
  
imports: import pandas
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import exponential
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.internal import tf_keras
  from tensorflow_probability.python.optimizer.convergence_criteria import successive_gradients_are_uncorrelated
  from tensorflow_probability.python.sts import default_model
  from tensorflow_probability.python.sts import fitting
  from tensorflow_probability.python.sts import regularization
  from tensorflow_probability.python.sts.components import local_linear_trend
  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.vi import optimization
label_desc: Use image node_id 5 for calling the DefaultModelTests obj's underlying member method code with example usage: obj.test_docstring_fitting_example() without return types