code: def compute_privacy_cost_per_bins(bin_num, votes, sigma2, order):
      """Outputs average privacy cost per bin.
  
      Args:
        bin_num: Number of bins.
        votes: A matrix of votes, where each row contains votes in one instance.
        sigma2: The scale (std) of the Gaussian noise. (Same as sigma_2 in
                Algorithms 1 and 2.)
        order: The Renyi order for which privacy cost is computed.
  
      Returns:
        Expected eps of RDP (ignoring delta) per example in each bin.
      """
      n = votes.shape[0]
  
      bin_counts = np.zeros(bin_num)
      bin_rdp = np.zeros(bin_num)  # RDP at order=order
  
      for i in xrange(n):
          v = votes[i,]
          logq = pate.compute_logq_gaussian(v, sigma2)
          rdp_at_order = pate.rdp_gaussian(logq, sigma2, order)
  
          bin_idx = int(math.floor(max(v) * bin_num / sum(v)))
          assert 0 <= bin_idx < bin_num
          bin_counts[bin_idx] += 1
          bin_rdp[bin_idx] += rdp_at_order
          if (i + 1) % 1000 == 0:
              print("example {}".format(i + 1))
              sys.stdout.flush()
  
      return bin_rdp / bin_counts
  
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 2 for calling a global function with example usage: compute_privacy_cost_per_bins(bin_num, votes, sigma2, order) and returns: unknown