The smooth seasonal model uses a set of trigonometric terms in order to capture a recurring pattern whereby adjacent (in time) effects are similar. The model uses frequencies calculated via:

  allow_drift = TRUE,
  drift_scale_prior = NULL,
  initial_state_prior = NULL,
  observed_time_series = NULL,
  name = NULL



positive scalar float Tensor giving the number of timesteps required for the longest cyclic effect to repeat.


One-dimensional float Tensor listing the frequencies (cyclic components) included in the model, as multipliers of the base/fundamental frequency 2. * pi / period. Each component is specified by the number of times it repeats per period, and adds two latent dimensions to the model. A smooth seasonal model that can represent any periodic function is given by frequency_multipliers = [1,2, ..., floor(period / 2)]. However, it is often desirable to enforce a smoothness assumption (and reduce the computational burden) by dropping some of the higher frequencies.


optional logical specifying whether the seasonal effects can drift over time. Setting this to FALSE removes the drift_scale parameter from the model. This is mathematically equivalent to drift_scale_prior = tfd.Deterministic(0.), but removing drift directly is preferred because it avoids the use of a degenerate prior. Default value: TRUE.


optional tfd$Distribution instance specifying a prior on the drift_scale parameter. If NULL, a heuristic default prior is constructed based on the provided observed_time_series. Default value: NULL.


instance of tfd$MultivariateNormal representing the prior distribution on the latent states. Must have event shape [2 * len(frequency_multipliers)]. If NULL, a heuristic default prior is constructed based on the provided observed_time_series.


optional float Tensor of shape batch_shape + [T, 1] (omitting the trailing unit dimension is also supported when T > 1), specifying an observed time series. Any priors not explicitly set will be given default values according to the scale of the observed time series (or batch of time series). May optionally be an instance of tfp$sts$MaskedTimeSeries, which includes a mask Tensor to specify timesteps with missing observations. Default value: NULL.


the name of this model component. Default value: 'LocalLinearTrend'.


an instance of StructuralTimeSeries.


frequencies[j] = 2. * pi * frequency_multipliers[j] / period

and then posits two latent states for each frequency. The two latent states associated with frequency j drift over time via:

effect[t] = (effect[t-1] * cos(frequencies[j]) +
             auxiliary[t-] * sin(frequencies[j]) +
             Normal(0., drift_scale))
auxiliary[t] = (-effect[t-1] * sin(frequencies[j]) +
                auxiliary[t-] * cos(frequencies[j]) +
                Normal(0., drift_scale))

where effect is the smooth seasonal effect and auxiliary only appears as a matter of construction. The interpretation of auxiliary is thus not particularly important.

See also