code: def compute_epsilon_and_acc(
      poison_arr, unpois_arr, threshold, alpha, pois_ct
  ):
      """For a given threshold, compute epsilon and accuracy."""
      poison_ct = (poison_arr > threshold).sum()
      unpois_ct = (unpois_arr > threshold).sum()
  
      # clopper_pearson uses alpha/2 budget on upper and lower
      # so total budget will be 2*alpha/2 = alpha
      p1, _ = proportion.proportion_confint(
          poison_ct, poison_arr.size, alpha, method="beta"
      )
      _, p0 = proportion.proportion_confint(
          unpois_ct, unpois_arr.size, alpha, method="beta"
      )
  
      if (p1 <= 1e-5) or (p0 >= 1 - 1e-5):  # divide by zero issues
          return 0, 0
  
      if (p0 + p1) > 1:  # see Appendix A
          p0, p1 = (1 - p1), (1 - p0)
  
      epsilon = np.log(p1 / p0) / pois_ct
      acc = (
          p1 + (1 - p0)
      ) / 2  # this is not necessarily the best accuracy
  
      return epsilon, acc
  
file_path: privacy/research/audit_2020/audit.py
imports: import numpy
  from statsmodels.stats import proportion
  import attacks
label_desc: Use image node_id 2 for calling a global function with example usage: compute_epsilon_and_acc(poison_arr, unpois_arr, threshold, alpha, pois_ct) and returns: epsilon,  acc, int,  int