def __init__(self,<EOL>components,<EOL>constant_offset=None,<EOL>observation_noise_scale_prior=None,<EOL>observed_time_series=None,<EOL>name=None):
with tf.compat.v1.name_scope(<EOL>name, '<STR_LIT>', values=[observed_time_series]) as name:<EOL><INDENT>if observed_time_series is not None:<EOL><INDENT>observed_mean, observed_stddev, _ = (<EOL>sts_util.empirical_statistics(observed_time_series))<EOL><DEDENT>else:<EOL><INDENT>observed_mean, observed_stddev = <NUM_LIT:0.>, <NUM_LIT:1.><EOL><DEDENT>if observation_noise_scale_prior is None:<EOL><INDENT>observation_noise_scale_prior = tfd.LogNormal(<EOL>loc=tf.math.log(<NUM_LIT> * observed_stddev), scale=<NUM_LIT>)<EOL><DEDENT>if constant_offset is None:<EOL><INDENT>constant_offset = observed_mean<EOL><DEDENT>component_names = [c.name for c in components]<EOL>if len(component_names) != len(set(component_names)):<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'.format(component_names))<EOL><DEDENT>components_by_name = collections.OrderedDict(<EOL>[(c.name, c) for c in components])<EOL>parameters = [<EOL>Parameter('<STR_LIT>', observation_noise_scale_prior,<EOL>tfb.Softplus()),<EOL>] + [Parameter(name='<STR_LIT>'.format(component.name, parameter.name),<EOL>prior=parameter.prior,<EOL>bijector=parameter.bijector)<EOL>for component in components for parameter in component.parameters]<EOL>self._components = components<EOL>self._components_by_name = components_by_name<EOL>self._constant_offset = constant_offset<EOL>super(Sum, self).__init__(<EOL>parameters=parameters,<EOL>latent_size=sum(<EOL>[component.latent_size for component in components]),<EOL>name=name)<EOL><DEDENT>
Specify a structural time series model representing a sum of components.

        Args:
          components: Python `list` of one or more StructuralTimeSeries instances.
            These must have unique names.
          constant_offset: optional scalar `float` `Tensor`, or batch of scalars,
            specifying a constant value added to the sum of outputs from the
            component models. This allows the components to model the shifted series
            `observed_time_series - constant_offset`. If `None`, this is set to the
            mean of the provided `observed_time_series`.
            Default value: `None`.
          observation_noise_scale_prior: optional `tfd.Distribution` instance
            specifying a prior on `observation_noise_scale`. If `None`, a heuristic
            default prior is constructed based on the provided
            `observed_time_series`.
            Default value: `None`.
          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. This is
            used to set the constant offset, if not provided, and to construct a
            default heuristic `observation_noise_scale_prior` if not provided. May
            optionally be an instance of `tfp.sts.MaskedTimeSeries`, which includes
            a mask `Tensor` to specify timesteps with missing observations.
            Default value: `None`.
          name: Python `str` name of this model component; used as `name_scope`
            for ops created by this class.
            Default value: 'Sum'.

        Raises:
          ValueError: if components do not have unique names.