parameters: (self, y)
return_statement: return _logsum_expbig_minus_expsmall(big, small)
docstring: Compute log_prob(y) using log survival_function and cdf together.
docstring_summary: Compute log_prob(y) using log survival_function and cdf together.
docstring_tokens: Compute log_prob ( y ) using log survival_function and cdf together .
function: def _log_prob_with_logsf_and_logcdf(self, y):
      """Compute log_prob(y) using log survival_function and cdf together."""
      # There are two options that would be equal if we had infinite precision:
      # Log[ sf(y - 1) - sf(y) ]
      #   = Log[ exp{logsf(y - 1)} - exp{logsf(y)} ]
      # Log[ cdf(y) - cdf(y - 1) ]
      #   = Log[ exp{logcdf(y)} - exp{logcdf(y - 1)} ]
      logsf_y = self.log_survival_function(y)
      logsf_y_minus_1 = self.log_survival_function(y - 1)
      logcdf_y = self.log_cdf(y)
      logcdf_y_minus_1 = self.log_cdf(y - 1)
  
      # Important:  Here we use select in a way such that no input is inf, this
      # prevents the troublesome case where the output of select can be finite,
      # but the output of grad(select) will be NaN.
  
      # In either case, we are doing Log[ exp{big} - exp{small} ]
      # We want to use the sf items precisely when we are on the right side of the
      # median, which occurs when logsf_y < logcdf_y.
      big = array_ops.where(logsf_y < logcdf_y, logsf_y_minus_1, logcdf_y)
      small = array_ops.where(logsf_y < logcdf_y, logsf_y, logcdf_y_minus_1)
  
      return _logsum_expbig_minus_expsmall(big, small)
function_tokens: def _log_prob_with_logsf_and_logcdf ( self , y ) : # There are two options that would be equal if we had infinite precision: # Log[ sf(y - 1) - sf(y) ] #   = Log[ exp{logsf(y - 1)} - exp{logsf(y)} ] # Log[ cdf(y) - cdf(y - 1) ] #   = Log[ exp{logcdf(y)} - exp{logcdf(y - 1)} ] logsf_y = self . log_survival_function ( y ) logsf_y_minus_1 = self . log_survival_function ( y - 1 ) logcdf_y = self . log_cdf ( y ) logcdf_y_minus_1 = self . log_cdf ( y - 1 ) # Important:  Here we use select in a way such that no input is inf, this # prevents the troublesome case where the output of select can be finite, # but the output of grad(select) will be NaN. # In either case, we are doing Log[ exp{big} - exp{small} ] # We want to use the sf items precisely when we are on the right side of the # median, which occurs when logsf_y < logcdf_y. big = array_ops . where ( logsf_y < logcdf_y , logsf_y_minus_1 , logcdf_y ) small = array_ops . where ( logsf_y < logcdf_y , logsf_y , logcdf_y_minus_1 ) return _logsum_expbig_minus_expsmall ( big , small )