class_docstr: Formal representation of a seasonal effect model.
  
  A seasonal effect model posits a fixed set of recurring, discrete 'seasons',
  each of which is active for a fixed number of timesteps and, while active,
  contributes a different effect to the time series. These are generally not
  meteorological seasons, but represent regular recurring patterns such as
  hour-of-day or day-of-week effects. Each season lasts for a fixed number of
  timesteps. The effect of each season drifts from one occurrence to the next
  following a Gaussian random walk:
  
  ```python
  effects[season, occurrence[i]] = (
    effects[season, occurrence[i-1]] + Normal(loc=0., scale=drift_scale))
  ```
  
  The `drift_scale` parameter governs the standard deviation of the random walk;
  for example, in a day-of-week model it governs the change in effect from this
  Monday to next Monday.
  
  #### Examples
  
  A seasonal effect model representing day-of-week seasonality on hourly data:
  
  ```python
  day_of_week = tfp.sts.Seasonal(num_seasons=7,
                                 num_steps_per_season=24,
                                 observed_time_series=y,
                                 name='day_of_week')
  ```
  
  A seasonal effect model representing month-of-year seasonality on daily data,
  with explicit priors:
  
  ```python
  month_of_year = tfp.sts.Seasonal(
    num_seasons=12,
    num_steps_per_season=[31, 28, 31, 30, 30, 31, 31, 31, 30, 31, 30, 31],
    drift_scale_prior=tfd.LogNormal(loc=-1., scale=0.1),
    initial_effect_prior=tfd.Normal(loc=0., scale=5.),
    name='month_of_year')
  ```
  
  Note that this version works over time periods not involving a leap year. A
  general implementation of month-of-year seasonality would require additional
  logic:
  
  ```python
  num_days_per_month = np.array(
    [[31, 28, 31, 30, 30, 31, 31, 31, 30, 31, 30, 31],
     [31, 29, 31, 30, 30, 31, 31, 31, 30, 31, 30, 31],  # year with leap day
     [31, 28, 31, 30, 30, 31, 31, 31, 30, 31, 30, 31],
     [31, 28, 31, 30, 30, 31, 31, 31, 30, 31, 30, 31]])
  
  month_of_year = tfp.sts.Seasonal(
    num_seasons=12,
    num_steps_per_season=num_days_per_month,
    drift_scale_prior=tfd.LogNormal(loc=-1., scale=0.1),
    initial_effect_prior=tfd.Normal(loc=0., scale=5.),
    name='month_of_year')
  ```
  
  A model representing both day-of-week and hour-of-day seasonality, on hourly
  data:
  
  ```
  day_of_week = tfp.sts.Seasonal(num_seasons=7,
                                 num_steps_per_season=24,
                                 observed_time_series=y,
                                 name='day_of_week')
  hour_of_day = tfp.sts.Seasonal(num_seasons=24,
                                 num_steps_per_season=1,
                                 observed_time_series=y,
                                 name='hour_of_day')
  model = tfp.sts.Sum(components=[day_of_week, hour_of_day],
                      observed_time_series=y)
  ```
class_docstr_tok: ["Formal","representation","of","a","seasonal","effect","model",".","A","seasonal","effect","model","posits","a","fixed","set","of","recurring",",","discrete","'seasons","'",",","each","of","which","is","active","for","a","fixed","number","of","timesteps","and",",","while","active",",","contributes","a","different","effect","to","the","time","series",".","These","are","generally","not","meteorological","seasons",",","but","represent","regular","recurring","patterns","such","as","hour-of-day","or","day-of-week","effects",".","Each","season","lasts","for","a","fixed","number","of","timesteps",".","The","effect","of","each","season","drifts","from","one","occurrence","to","the","next","following","a","Gaussian","random","walk",":","``","`","python","effects","[","season",",","occurrence","[","i","]","]","=","(","effects","[","season",",","occurrence","[","i-1","]","]","+","Normal","(","loc=0.",",","scale=drift_scale",")",")","``","`","The","`","drift_scale","`","parameter","governs","the","standard","deviation","of","the","random","walk",";","for","example",",","in","a","day-of-week","model","it","governs","the","change","in","effect","from","this","Monday","to","next","Monday",".","#","#","#","#","Examples","A","seasonal","effect","model","representing","day-of-week","seasonality","on","hourly","data",":","``","`","python","day_of_week","=","tfp.sts.Seasonal","(","num_seasons=7",",","num_steps_per_season=24",",","observed_time_series=y",",","name='day_of_week","'",")","``","`","A","seasonal","effect","model","representing","month-of-year","seasonality","on","daily","data",",","with","explicit","priors",":","``","`","python","month_of_year","=","tfp.sts.Seasonal","(","num_seasons=12",",","num_steps_per_season=","[","31",",","28",",","31",",","30",",","30",",","31",",","31",",","31",",","30",",","31",",","30",",","31","]",",","drift_scale_prior=tfd.LogNormal","(","loc=-1.",",","scale=0.1",")",",","initial_effect_prior=tfd.Normal","(","loc=0.",",","scale=5",".",")",",","name='month_of_year","'",")","``","`","Note","that","this","version","works","over","time","periods","not","involving","a","leap","year",".","A","general","implementation","of","month-of-year","seasonality","would","require","additional","logic",":","``","`","python","num_days_per_month","=","np.array","(","[","[","31",",","28",",","31",",","30",",","30",",","31",",","31",",","31",",","30",",","31",",","30",",","31","]",",","[","31",",","29",",","31",",","30",",","30",",","31",",","31",",","31",",","30",",","31",",","30",",","31","]",",","#","year","with","leap","day","[","31",",","28",",","31",",","30",",","30",",","31",",","31",",","31",",","30",",","31",",","30",",","31","]",",","[","31",",","28",",","31",",","30",",","30",",","31",",","31",",","31",",","30",",","31",",","30",",","31","]","]",")","month_of_year","=","tfp.sts.Seasonal","(","num_seasons=12",",","num_steps_per_season=num_days_per_month",",","drift_scale_prior=tfd.LogNormal","(","loc=-1.",",","scale=0.1",")",",","initial_effect_prior=tfd.Normal","(","loc=0.",",","scale=5",".",")",",","name='month_of_year","'",")","``","`","A","model","representing","both","day-of-week","and","hour-of-day","seasonality",",","on","hourly","data",":","``","`","day_of_week","=","tfp.sts.Seasonal","(","num_seasons=7",",","num_steps_per_season=24",",","observed_time_series=y",",","name='day_of_week","'",")","hour_of_day","=","tfp.sts.Seasonal","(","num_seasons=24",",","num_steps_per_season=1",",","observed_time_series=y",",","name='hour_of_day","'",")","model","=","tfp.sts.Sum","(","components=","[","day_of_week",",","hour_of_day","]",",","observed_time_series=y",")","``","`"]
docstr: Number of steps per season.
docstr_tok: ["Number","of","steps","per","season","."]
code: def num_steps_per_season(self):
      """Number of steps per season."""
      return self._num_steps_per_season
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.bijectors import scale
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.bijectors import square
  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 mvn_diag
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.experimental.sts_gibbs import sample_parameters
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import docstring_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.sts.internal import util
  from tensorflow_probability.python.sts.structural_time_series import Parameter
  from tensorflow_probability.python.sts.structural_time_series import StructuralTimeSeries
label_desc: Use image node_id 5 for calling the Seasonal obj's underlying member method code with example usage: obj.num_steps_per_season() and returns: self