original_docstring: Generated log-density function.
docstring: Generated log-density function.
docstring_tokens: Generated log - density function .
code: def log_joint_fn(*param_vals, **param_kwargs):
          """Generated log-density function."""
  
          if param_kwargs:
            if param_vals: raise ValueError(
                'log_joint_fn saw both positional args ({}) and named args ({}). '
                'This is not supported: you have to choose!'.format(
                    param_vals, param_kwargs))
            param_vals = [param_kwargs[p.name] for p in self.parameters]
  
          # Sum the log_prob values from parameter priors.
          param_lp = sum([
              param.prior.log_prob(param_val)
              for (param, param_val) in zip(self.parameters, param_vals)
          ])
  
          # Build a linear Gaussian state space model and evaluate the marginal
          # log_prob on observations.
          lgssm = self.make_state_space_model(
              param_vals=param_vals, num_timesteps=num_timesteps)
          observation_lp = lgssm.log_prob(observed_time_series, mask=mask)
  
          # Sum over likelihoods from iid observations. Without this sum,
          # adding `param_lp + observation_lp` would broadcast the param priors
          # over the sample shape, which incorrectly multi-counts the param
          # priors.
          sample_ndims = tf.maximum(0,
                                    tf.rank(observation_lp) - tf.rank(param_lp))
          observation_lp = tf.reduce_sum(
              observation_lp, axis=tf.range(sample_ndims))
  
          return param_lp + observation_lp
code_tokens: def log_joint_fn ( * param_vals , ** param_kwargs ) : if param_kwargs : if param_vals : raise ValueError ( 'log_joint_fn saw both positional args ({}) and named args ({}). ' 'This is not supported: you have to choose!' . format ( param_vals , param_kwargs ) ) param_vals = [ param_kwargs [ p . name ] for p in self . parameters ] param_lp = sum ( [ param . prior . log_prob ( param_val ) for ( param , param_val ) in zip ( self . parameters , param_vals ) ] ) lgssm = self . make_state_space_model ( param_vals = param_vals , num_timesteps = num_timesteps ) observation_lp = lgssm . log_prob ( observed_time_series , mask = mask ) sample_ndims = tf . maximum ( 0 , tf . rank ( observation_lp ) - tf . rank ( param_lp ) ) observation_lp = tf . reduce_sum ( observation_lp , axis = tf . range ( sample_ndims ) ) return param_lp + observation_lp
short_docstring: Generated log-density function.
short_docstring_tokens: Generated log - density function .
comment: """Generated log-density function."""$SEP$# Sum the log_prob values from parameter priors.$SEP$# Build a linear Gaussian state space model and evaluate the marginal$SEP$# log_prob on observations.$SEP$# Sum over likelihoods from iid observations. Without this sum,$SEP$# adding `param_lp + observation_lp` would broadcast the param priors$SEP$# over the sample shape, which incorrectly multi-counts the param$SEP$# priors.