class_docstr: State space model for a local linear trend.
  
  A state space model (SSM) posits a set of latent (unobserved) variables that
  evolve over time with dynamics specified by a probabilistic transition model
  `p(z[t+1] | z[t])`. At each timestep, we observe a value sampled from an
  observation model conditioned on the current state, `p(x[t] | z[t])`. The
  special case where both the transition and observation models are Gaussians
  with mean specified as a linear function of the inputs, is known as a linear
  Gaussian state space model and supports tractable exact probabilistic
  calculations; see `tfp.distributions.LinearGaussianStateSpaceModel` for
  details.
  
  The local linear trend model is a special case of a linear Gaussian SSM, in
  which the latent state posits a `level` and `slope`, each evolving via a
  Gaussian random walk:
  
  ```python
  level[t] = level[t-1] + slope[t-1] + Normal(0., level_scale)
  slope[t] = slope[t-1] + Normal(0., slope_scale)
  ```
  
  The latent state is the two-dimensional tuple `[level, slope]`. The
  `level` is observed at each timestep.
  
  The parameters `level_scale`, `slope_scale`, and `observation_noise_scale`
  are each (a batch of) scalars. The batch shape of this `Distribution` is the
  broadcast batch shape of these parameters and of the `initial_state_prior`.
  
  #### Mathematical Details
  
  The linear trend model implements a
  `tfp.distributions.LinearGaussianStateSpaceModel` with `latent_size = 2`
  and `observation_size = 1`, following the transition model:
  
  ```
  transition_matrix = [[1., 1.]
                       [0., 1.]]
  transition_noise ~ N(loc=0., scale=diag([level_scale, slope_scale]))
  ```
  
  which implements the evolution of `[level, slope]` described above, and
  the observation model:
  
  ```
  observation_matrix = [[1., 0.]]
  observation_noise ~ N(loc=0, scale=observation_noise_scale)
  ```
  
  which picks out the first latent component, i.e., the `level`, as the
  observation at each timestep.
  
  #### Examples
  
  A simple model definition:
  
  ```python
  linear_trend_model = LocalLinearTrendStateSpaceModel(
      num_timesteps=50,
      level_scale=0.5,
      slope_scale=0.5,
      initial_state_prior=tfd.MultivariateNormalDiag(scale_diag=[1., 1.]))
  
  y = linear_trend_model.sample() # y has shape [50, 1]
  lp = linear_trend_model.log_prob(y) # log_prob is scalar
  ```
  
  Passing additional parameter dimensions constructs a batch of models. The
  overall batch shape is the broadcast batch shape of the parameters:
  
  ```python
  linear_trend_model = LocalLinearTrendStateSpaceModel(
      num_timesteps=50,
      level_scale=tf.ones([10]),
      slope_scale=0.5,
      initial_state_prior=tfd.MultivariateNormalDiag(
        scale_diag=tf.ones([10, 10, 2])))
  
  y = linear_trend_model.sample(5) # y has shape [5, 10, 10, 50, 1]
  lp = linear_trend_model.log_prob(y) # has shape [5, 10, 10]
  ```
class_docstr_tok: ["State","space","model","for","a","local","linear","trend",".","A","state","space","model","(","SSM",")","posits","a","set","of","latent","(","unobserved",")","variables","that","evolve","over","time","with","dynamics","specified","by","a","probabilistic","transition","model","`","p","(","z","[","t+1","]","|","z","[","t","]",")","`",".","At","each","timestep",",","we","observe","a","value","sampled","from","an","observation","model","conditioned","on","the","current","state",",","`","p","(","x","[","t","]","|","z","[","t","]",")","`",".","The","special","case","where","both","the","transition","and","observation","models","are","Gaussians","with","mean","specified","as","a","linear","function","of","the","inputs",",","is","known","as","a","linear","Gaussian","state","space","model","and","supports","tractable","exact","probabilistic","calculations",";","see","`","tfp.distributions.LinearGaussianStateSpaceModel","`","for","details",".","The","local","linear","trend","model","is","a","special","case","of","a","linear","Gaussian","SSM",",","in","which","the","latent","state","posits","a","`","level","`","and","`","slope","`",",","each","evolving","via","a","Gaussian","random","walk",":","``","`","python","level","[","t","]","=","level","[","t-1","]","+","slope","[","t-1","]","+","Normal","(","0.",",","level_scale",")","slope","[","t","]","=","slope","[","t-1","]","+","Normal","(","0.",",","slope_scale",")","``","`","The","latent","state","is","the","two-dimensional","tuple","`","[","level",",","slope","]","`",".","The","`","level","`","is","observed","at","each","timestep",".","The","parameters","`","level_scale","`",",","`","slope_scale","`",",","and","`","observation_noise_scale","`","are","each","(","a","batch","of",")","scalars",".","The","batch","shape","of","this","`","Distribution","`","is","the","broadcast","batch","shape","of","these","parameters","and","of","the","`","initial_state_prior","`",".","#","#","#","#","Mathematical","Details","The","linear","trend","model","implements","a","`","tfp.distributions.LinearGaussianStateSpaceModel","`","with","`","latent_size","=","2","`","and","`","observation_size","=","1","`",",","following","the","transition","model",":","``","`","transition_matrix","=","[","[","1.",",","1",".","]","[","0.",",","1",".","]","]","transition_noise","~","N","(","loc=0.",",","scale=diag","(","[","level_scale",",","slope_scale","]",")",")","``","`","which","implements","the","evolution","of","`","[","level",",","slope","]","`","described","above",",","and","the","observation","model",":","``","`","observation_matrix","=","[","[","1.",",","0",".","]","]","observation_noise","~","N","(","loc=0",",","scale=observation_noise_scale",")","``","`","which","picks","out","the","first","latent","component",",","i.e.",",","the","`","level","`",",","as","the","observation","at","each","timestep",".","#","#","#","#","Examples","A","simple","model","definition",":","``","`","python","linear_trend_model","=","LocalLinearTrendStateSpaceModel","(","num_timesteps=50",",","level_scale=0.5",",","slope_scale=0.5",",","initial_state_prior=tfd.MultivariateNormalDiag","(","scale_diag=","[","1.",",","1",".","]",")",")","y","=","linear_trend_model.sample","(",")","#","y","has","shape","[","50",",","1","]","lp","=","linear_trend_model.log_prob","(","y",")","#","log_prob","is","scalar","``","`","Passing","additional","parameter","dimensions","constructs","a","batch","of","models",".","The","overall","batch","shape","is","the","broadcast","batch","shape","of","the","parameters",":","``","`","python","linear_trend_model","=","LocalLinearTrendStateSpaceModel","(","num_timesteps=50",",","level_scale=tf.ones","(","[","10","]",")",",","slope_scale=0.5",",","initial_state_prior=tfd.MultivariateNormalDiag","(","scale_diag=tf.ones","(","[","10",",","10",",","2","]",")",")",")","y","=","linear_trend_model.sample","(","5",")","#","y","has","shape","[","5",",","10",",","10",",","50",",","1","]","lp","=","linear_trend_model.log_prob","(","y",")","#","has","shape","[","5",",","10",",","10","]","``","`"]
docstr: Standard deviation of the slope transitions.
docstr_tok: ["Standard","deviation","of","the","slope","transitions","."]
code: def slope_scale(self):
      """Standard deviation of the slope transitions."""
      return self._slope_scale
  
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import scale
  from tensorflow_probability.python.bijectors import softplus
  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 normal
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
  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 3 for calling the LocalLinearTrendStateSpaceModel obj's underlying member method code with example usage: obj.slope_scale() and returns: self