code: def compute_expected_answered_per_bin(
      bin_num, votes, threshold, sigma1
  ):
      """Computes expected number of answers per bin.
  
      Args:
        bin_num: Number of bins.
        votes: A matrix of votes, where each row contains votes in one instance.
        threshold: The threshold against which check is performed.
        sigma1: The std of the Gaussian noise with which check is performed. (Same
          as sigma_1 in Algorithms 1 and 2.)
  
      Returns:
        Expected number of queries answered per bin.
      """
      n = votes.shape[0]
  
      bin_answered = np.zeros(bin_num)
  
      for i in xrange(n):
          v = votes[i,]
          p = math.exp(
              pate.compute_logpr_answered(threshold, sigma1, v)
          )
          bin_idx = int(math.floor(max(v) * bin_num / sum(v)))
          assert 0 <= bin_idx < bin_num
          bin_answered[bin_idx] += p
          if (i + 1) % 1000 == 0:
              print("example {}".format(i + 1))
              sys.stdout.flush()
  
      return bin_answered
  
file_path: privacy/research/pate_2018/ICLR2018/rdp_bucketized.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import os
  import sys
  from absl import app
  from absl import flags
  import core
  import matplotlib
  import matplotlib.pyplot
  import numpy
  from six.moves import xrange
label_desc: Use image node_id 3 for calling a global function with example usage: compute_expected_answered_per_bin(bin_num, votes, threshold, sigma1) and returns: bin_answered