Python tensorflow.python.ops.math_ops.betainc() Examples

The following are 11 code examples of tensorflow.python.ops.math_ops.betainc(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tensorflow.python.ops.math_ops , or try the search function .
Example #1
Source File: binomial.py    From lambda-packs with MIT License 6 votes vote down vote up
def _bdtr(k, n, p):
  """The binomial cumulative distribution function.

  Args:
    k: floating point `Tensor`.
    n: floating point `Tensor`.
    p: floating point `Tensor`.

  Returns:
    `sum_{j=0}^k p^j (1 - p)^(n - j)`.
  """
  # Trick for getting safe backprop/gradients into n, k when
  #   betainc(a = 0, ..) = nan
  # Write:
  #   where(unsafe, safe_output, betainc(where(unsafe, safe_input, input)))
  ones = array_ops.ones_like(n - k)
  k_eq_n = math_ops.equal(k, n)
  safe_dn = array_ops.where(k_eq_n, ones, n - k)
  dk = math_ops.betainc(a=safe_dn, b=k + 1, x=1 - p)
  return array_ops.where(k_eq_n, ones, dk) 
Example #2
Source File: beta.py    From lambda-packs with MIT License 5 votes vote down vote up
def _cdf(self, x):
    return math_ops.betainc(self.concentration1, self.concentration0, x) 
Example #3
Source File: student_t.py    From lambda-packs with MIT License 5 votes vote down vote up
def _cdf(self, x):
    # Take Abs(scale) to make subsequent where work correctly.
    y = (x - self.loc) / math_ops.abs(self.scale)
    x_t = self.df / (y**2. + self.df)
    neg_cdf = 0.5 * math_ops.betainc(0.5 * self.df, 0.5, x_t)
    return array_ops.where(math_ops.less(y, 0.), neg_cdf, 1. - neg_cdf) 
Example #4
Source File: negative_binomial.py    From lambda-packs with MIT License 5 votes vote down vote up
def _cdf(self, positive_counts):
    if self.validate_args:
      positive_counts = math_ops.floor(
          distribution_util.embed_check_nonnegative_discrete(
              positive_counts, check_integer=False))
    return math_ops.betainc(
        self.total_count, positive_counts + 1.,
        math_ops.sigmoid(-self.logits)) 
Example #5
Source File: beta.py    From auto-alt-text-lambda-api with MIT License 5 votes vote down vote up
def _cdf(self, x):
    return math_ops.betainc(self.a, self.b, x) 
Example #6
Source File: student_t.py    From auto-alt-text-lambda-api with MIT License 5 votes vote down vote up
def _cdf(self, x):
    # Take Abs(sigma) to make subsequent where work correctly.
    y = (x - self.mu) / math_ops.abs(self.sigma)
    x_t = self.df / (y**2. + self.df)
    neg_cdf = 0.5 * math_ops.betainc(0.5 * self.df, 0.5, x_t)
    return array_ops.where(math_ops.less(y, 0.), neg_cdf, 1. - neg_cdf) 
Example #7
Source File: beta.py    From deep_image_model with Apache License 2.0 5 votes vote down vote up
def _cdf(self, x):
    return math_ops.betainc(self.a, self.b, x) 
Example #8
Source File: beta.py    From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License 5 votes vote down vote up
def _cdf(self, x):
    return math_ops.betainc(self.concentration1, self.concentration0, x) 
Example #9
Source File: student_t.py    From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License 5 votes vote down vote up
def _cdf(self, x):
    # Take Abs(scale) to make subsequent where work correctly.
    y = (x - self.loc) / math_ops.abs(self.scale)
    x_t = self.df / (y**2. + self.df)
    neg_cdf = 0.5 * math_ops.betainc(0.5 * self.df, 0.5, x_t)
    return array_ops.where(math_ops.less(y, 0.), neg_cdf, 1. - neg_cdf) 
Example #10
Source File: beta.py    From keras-lambda with MIT License 5 votes vote down vote up
def _cdf(self, x):
    return math_ops.betainc(self.a, self.b, x) 
Example #11
Source File: student_t.py    From keras-lambda with MIT License 5 votes vote down vote up
def _cdf(self, x):
    # Take Abs(sigma) to make subsequent where work correctly.
    y = (x - self.mu) / math_ops.abs(self.sigma)
    x_t = self.df / (y**2. + self.df)
    neg_cdf = 0.5 * math_ops.betainc(0.5 * self.df, 0.5, x_t)
    return array_ops.where(math_ops.less(y, 0.), neg_cdf, 1. - neg_cdf)