code: def test_month_of_year_example(self):
      seed = test_util.test_seed(sampler_type="stateless")
      num_days_per_month = np.array(
          [31, 28, 31, 30, 30, 31, 31, 31, 30, 31, 30, 31]
      )
  
      # put wildly different near-deterministic priors on the effect for each
      # month, so we can easily distinguish the months and diagnose off-by-one
      # errors.
      monthly_effect_prior_means = np.linspace(-1000, 1000, 12)
      monthly_effect_prior_scales = 0.1 * np.ones(12)
      drift_scale = 0.3
      observation_noise_scale = 0.1
      num_timesteps = 365 * 2  # 2 years.
      initial_step = 22
  
      month_of_year = SeasonalStateSpaceModel(
          num_timesteps=num_timesteps,
          num_seasons=12,
          num_steps_per_season=num_days_per_month,
          drift_scale=self._build_placeholder(drift_scale),
          observation_noise_scale=observation_noise_scale,
          initial_state_prior=mvn_diag.MultivariateNormalDiag(
              loc=self._build_placeholder(monthly_effect_prior_means),
              scale_diag=self._build_placeholder(
                  monthly_effect_prior_scales
              ),
          ),
          initial_step=initial_step,
      )
  
      sampled_series_, prior_mean_, prior_variance_ = self.evaluate(
          (
              month_of_year.sample(seed=seed)[..., 0],
              month_of_year.mean()[..., 0],
              month_of_year.variance()[..., 0],
          )
      )
  
      # For each month, ensure the mean (and samples) of each day matches the
      # expected effect for that month, and that the variances all match
      # including expected drift from year to year
      current_idx = -initial_step  # start at beginning of year
      current_drift_variance = 0.0
      for _ in range(
          3
      ):  # loop over three years to include entire 2-year period
          for (
              num_days_in_month,
              prior_effect_mean,
              prior_effect_scale,
          ) in zip(
              num_days_per_month,
              monthly_effect_prior_means,
              monthly_effect_prior_scales,
          ):
              month_indices = range(
                  current_idx, current_idx + num_days_in_month
              )
              current_idx += num_days_in_month
  
              # Trim any indices outside of the observed window.
              month_indices = [
                  idx
                  for idx in month_indices
                  if 0 <= idx < num_timesteps
              ]
  
              if month_indices:
                  ones = np.ones(len(month_indices))
                  self.assertAllClose(
                      sampled_series_[month_indices],
                      prior_effect_mean * ones,
                      atol=20.0,
                  )
                  self.assertAllClose(
                      prior_mean_[month_indices],
                      prior_effect_mean * ones,
                      atol=1e-4,
                  )
                  self.assertAllClose(
                      prior_variance_[month_indices],
                      (
                          prior_effect_scale**2
                          + current_drift_variance
                          + observation_noise_scale**2
                      )
                      * ones,
                      atol=1e-4,
                  )
  
          # At the end of each year, allow the effects to drift.
          current_drift_variance += drift_scale**2
  
imports: import math
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v1
  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 categorical
  from tensorflow_probability.python.distributions import inverse_gamma
  from tensorflow_probability.python.distributions import linear_gaussian_ssm
  from tensorflow_probability.python.distributions import lognormal
  from tensorflow_probability.python.distributions import mixture_same_family
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.sts.components.seasonal import ConstrainedSeasonalStateSpaceModel
  from tensorflow_probability.python.sts.components.seasonal import Seasonal
  from tensorflow_probability.python.sts.components.seasonal import SeasonalStateSpaceModel
label_desc: Use image node_id 2 for calling the _SeasonalStateSpaceModelTest obj's underlying member method code with example usage: obj.test_month_of_year_example() without return types