code: def compute_q_noisy_max(counts, noise_eps):
      """returns ~ Pr[outcome != winner].
  
      Args:
        counts: a list of scores
        noise_eps: privacy parameter for noisy_max
      Returns:
        q: the probability that outcome is different from true winner.
      """
      # For noisy max, we only get an upper bound.
      # Pr[ j beats i*] \leq (2+gap(j,i*))/ 4 exp(gap(j,i*)
      # proof at http://mathoverflow.net/questions/66763/
      # tight-bounds-on-probability-of-sum-of-laplace-random-variables
  
      winner = np.argmax(counts)
      counts_normalized = noise_eps * (counts - counts[winner])
      counts_rest = np.array(
          [
              counts_normalized[i]
              for i in xrange(len(counts))
              if i != winner
          ]
      )
      q = 0.0
      for c in counts_rest:
          gap = -c
          q += (gap + 2.0) / (4.0 * math.exp(gap))
      return min(q, 1.0 - (1.0 / len(counts)))
  
file_path: privacy/research/pate_2017/analysis.py
imports: import os
  import math
  import numpy
  from six.moves import xrange
  import tensorflow.compat.v1
  import maybe_download
label_desc: Use image node_id 1 for calling a global function with example usage: compute_q_noisy_max(counts, noise_eps) and returns: min