Beispiel #1
0
 def _cdf(self, x):
     if self.validate_args:
         # We set `check_integer=False` since the CDF is defined on whole real
         # line.
         x = distribution_util.embed_check_nonnegative_discrete(
             x, check_integer=False)
     return math_ops.igammac(math_ops.floor(x + 1), self.rate)
Beispiel #2
0
 def _cdf(self, x):
   if self.validate_args:
     # We set `check_integer=False` since the CDF is defined on whole real
     # line.
     x = distribution_util.embed_check_nonnegative_discrete(
         x, check_integer=False)
   return math_ops.igammac(math_ops.floor(x + 1), self.rate)
Beispiel #3
0
 def _cdf(self, x):
   if self.validate_args:
     x = distribution_util.embed_check_nonnegative_integer_form(x)
   else:
     # Whether or not x is integer-form, the following is well-defined.
     # However, scipy takes the floor, so we do too.
     x = math_ops.floor(x)
   return math_ops.igammac(1. + x, self.rate)
Beispiel #4
0
    def cdf(self, x, name="cdf"):
        """CDF of observations `x` under these InverseGamma distribution(s).

    Args:
      x: tensor of dtype `dtype`, must be broadcastable with `alpha` and `beta`.
      name: The name to give this op.

    Returns:
      cdf: tensor of dtype `dtype`, the CDFs of `x`.
    """
        with ops.name_scope(self.name):
            with ops.op_scope([self._alpha, self._beta, x], name):
                return math_ops.igammac(self._alpha, self._beta / x)
Beispiel #5
0
  def cdf(self, x, name="cdf"):
    """CDF of observations `x` under these InverseGamma distribution(s).

    Args:
      x: tensor of dtype `dtype`, must be broadcastable with `alpha` and `beta`.
      name: The name to give this op.

    Returns:
      cdf: tensor of dtype `dtype`, the CDFs of `x`.
    """
    with ops.name_scope(self.name):
      with ops.op_scope([self._alpha, self._beta, x], name):
        return math_ops.igammac(self._alpha, self._beta / x)
Beispiel #6
0
  def cdf(self, x, name="cdf"):
    """Cumulative density function.

    Args:
      x: Non-negative floating point tensor with dtype `dtype` and whose shape
        can be broadcast with `self.lam`.
      name: A name for this operation.

    Returns:
      The CDF of the events.
    """
    with ops.name_scope(self.name):
      with ops.name_scope(name, values=[self.lam, x]):
        x = self._check_x(x, check_integer=False)
        return math_ops.igammac(math_ops.floor(x + 1), self.lam)
Beispiel #7
0
    def cdf(self, x, name="cdf"):
        """Cumulative density function.

    Args:
      x: Non-negative floating point tensor with dtype `dtype` and whose shape
        can be broadcast with `self.lam`.
      name: A name for this operation.

    Returns:
      The CDF of the events.
    """
        with ops.name_scope(self.name):
            with ops.name_scope(name, values=[self.lam, x]):
                x = self._check_x(x, check_integer=False)
                return math_ops.igammac(math_ops.floor(x + 1), self.lam)
    def log_cdf(self, x, name="log_cdf"):
        """Log CDF of observations `x` under these InverseGamma distribution(s).

    Args:
      x: tensor of dtype `dtype`, must be broadcastable with `alpha` and `beta`.
      name: The name to give this op.

    Returns:
      log_cdf: tensor of dtype `dtype`, the log-CDFs of `x`.
    """
        with ops.name_scope(self.name):
            with ops.op_scope([self._alpha, self._beta, x], name):
                x = ops.convert_to_tensor(x)
                x = control_flow_ops.with_dependencies([check_ops.assert_positive(x)] if self.strict else [], x)
                contrib_tensor_util.assert_same_float_dtype(tensors=[x], dtype=self.dtype)
                # Note that igammac returns the upper regularized incomplete gamma
                # function Q(a, x), which is what we want for the CDF.
                return math_ops.log(math_ops.igammac(self._alpha, self._beta / x))
Beispiel #9
0
  def log_cdf(self, x, name="log_cdf"):
    """Log CDF of observations `x` under these InverseGamma distribution(s).

    Args:
      x: tensor of dtype `dtype`, must be broadcastable with `alpha` and `beta`.
      name: The name to give this op.

    Returns:
      log_cdf: tensor of dtype `dtype`, the log-CDFs of `x`.
    """
    with ops.name_scope(self.name):
      with ops.name_scope(name, values=[self._alpha, self._beta, x]):
        x = ops.convert_to_tensor(x)
        x = control_flow_ops.with_dependencies([check_ops.assert_positive(x)] if
                                               self.validate_args else [], x)
        contrib_tensor_util.assert_same_float_dtype(tensors=[x,],
                                                    dtype=self.dtype)
        # Note that igammac returns the upper regularized incomplete gamma
        # function Q(a, x), which is what we want for the CDF.
        return math_ops.log(math_ops.igammac(self._alpha, self._beta / x))
Beispiel #10
0
def _igammac(a, x):
    return math_ops.igammac(a, x)
Beispiel #11
0
 def _cdf(self, x):
     x = self._assert_valid_sample(x, check_integer=False)
     return math_ops.igammac(math_ops.floor(x + 1), self.lam)
Beispiel #12
0
 def _cdf(self, x):
     x = self._maybe_assert_valid_sample(x)
     # Note that igammac returns the upper regularized incomplete gamma
     # function Q(a, x), which is what we want for the CDF.
     return math_ops.igammac(self.concentration, self.rate / x)
 def _cdf(self, x):
     x = control_flow_ops.with_dependencies(
         [check_ops.assert_positive(x)] if self.validate_args else [], x)
     # Note that igammac returns the upper regularized incomplete gamma
     # function Q(a, x), which is what we want for the CDF.
     return math_ops.igammac(self.alpha, self.beta / x)
Beispiel #14
0
 def _cdf(self, x):
   x = self._maybe_assert_valid_sample(x)
   # Note that igammac returns the upper regularized incomplete gamma
   # function Q(a, x), which is what we want for the CDF.
   return math_ops.igammac(self.concentration, self.rate / x)
Beispiel #15
0
 def _cdf(self, x):
   x = control_flow_ops.with_dependencies([check_ops.assert_positive(x)] if
                                          self.validate_args else [], x)
   # Note that igammac returns the upper regularized incomplete gamma
   # function Q(a, x), which is what we want for the CDF.
   return math_ops.igammac(self.alpha, self.beta / x)
Beispiel #16
0
 def _cdf(self, x):
   x = self._assert_valid_sample(x, check_integer=False)
   return math_ops.igammac(math_ops.floor(x + 1), self.lam)
Beispiel #17
0
 def _cdf(self, x):
   if self.validate_args:
     x = distribution_util.embed_check_nonnegative_integer_form(x)
   return math_ops.igammac(1. + x, self.rate)