code: def _clopper_pearson_confidence_interval(samples, error_rate):
      """Computes a confidence interval for the mean of the given 1-D distribution.
  
      Assumes (and checks) that the given distribution is Bernoulli, i.e.,
      takes only two values.  This licenses using the CDF of the binomial
      distribution for the confidence, which is tighter (for extreme
      probabilities) than the DKWM inequality.  The method is known as the
      [Clopper-Pearson method]
      (https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval).
  
      Assumes:
  
      - The given samples were drawn iid from the distribution of interest.
  
      - The given distribution is a Bernoulli, i.e., supported only on
        low and high.
  
      Guarantees:
  
      - The probability (over the randomness of drawing the given sample)
        that the true mean is outside the returned interval is no more
        than the given error_rate.
  
      Args:
        samples: `np.ndarray` of samples drawn iid from the distribution
          of interest.
        error_rate: Python `float` admissible rate of mistakes.
  
      Returns:
        low: Lower bound of confidence interval.
        high: Upper bound of confidence interval.
  
      Raises:
        ValueError: If `samples` has rank other than 1 (batch semantics
          are not implemented), or if `samples` contains values other than
          `low` or `high` (as that makes the distribution not Bernoulli).
      """
      # TODO(b/78025336) Migrate this confidence interval function
      # to statistical_testing.py.  In order to do that
      # - Get the binomial CDF from the Binomial distribution
      # - Implement scalar root finding in TF.  Batch bisection search
      #   shouldn't be too hard, and is definitely good enough for this
      #   problem.  Batching the Brent algorithm (from scipy) that is used
      #   here may be more involved, but may also not be necessary---it's
      #   only used here because scipy made it convenient.  In particular,
      #   robustness is more important than speed here, which may make
      #   bisection search actively better.
      # - The rest is just a matter of rewriting in the appropriate style.
      if len(samples.shape) != 1:
          raise ValueError("Batch semantics not implemented")
      n = len(samples)
      low = np.amin(samples)
      high = np.amax(samples)
      if low == high:
          msg = (
              "Cannot compute Clopper-Pearson interval: all samples "
              "are equal to {}.".format(low)
          )
          raise ValueError(msg)
      successes = np.count_nonzero(samples - low)
      failures = np.count_nonzero(samples - high)
      if successes + failures != n:
          uniques = np.unique(samples)
          msg = (
              "Purportedly Bernoulli distribution had distinct samples"
              " {}, {}, and {}".format(
                  uniques[0], uniques[1], uniques[2]
              )
          )
          raise ValueError(msg)
      (
          low_p,
          high_p,
      ) = empirical_statistical_testing.binomial_confidence_interval(
          successes, n, error_rate
      )
      low_interval = low + (high - low) * low_p
      high_interval = low + (high - low) * high_p
      return (low_interval, high_interval)
  
file_path: probability/tensorflow_probability/python/distributions/internal/correlation_matrix_volumes_lib.py
imports: import sys
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import uniform
  from tensorflow_probability.python.internal import empirical_statistical_testing
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.math.linalg import fill_triangular
label_desc: Use image node_id 5 for calling a global function with example usage: _clopper_pearson_confidence_interval(samples, error_rate) and returns: low_interval,  high_interval