code: def main(argv):
      del argv  # Unused.
  
      if (FLAGS.threshold is None) != (FLAGS.sigma1 is None):
          raise ValueError(
              "--threshold flag and --sigma1 flag must be present or absent "
              "simultaneously."
          )
  
      if FLAGS.order is None:
          # Long list of orders.
          orders = np.concatenate(
              (
                  np.arange(2, 100 + 1, 0.5),
                  np.logspace(np.log10(100), np.log10(500), num=100),
              )
          )
          # Short list of orders.
          # orders = np.round(
          #     np.concatenate((np.arange(2, 50 + 1, 1),
          #                     np.logspace(np.log10(50), np.log10(1000), num=20))))
      else:
          orders = np.array([FLAGS.order])
  
      votes, baseline = _load_votes(
          FLAGS.counts_file, FLAGS.baseline_file, FLAGS.queries
      )
  
      if FLAGS.teachers is None:
          num_teachers = _count_teachers(votes)
      else:
          num_teachers = FLAGS.teachers
  
      num_classes = votes.shape[1]
  
      order = _compute_rdp(
          votes,
          baseline,
          FLAGS.threshold,
          FLAGS.sigma1,
          FLAGS.sigma2,
          FLAGS.delta,
          orders,
          FLAGS.data_independent,
      )
  
      ind_step1 = _is_data_ind_step1(
          num_teachers, FLAGS.threshold, FLAGS.sigma1, order
      )
  
      ind_step2 = _is_data_ind_step2(
          num_teachers, num_classes, FLAGS.sigma2, order
      )
  
      if FLAGS.data_independent or (ind_step1 and ind_step2):
          print(
              "Nothing to do here, all analyses are data-independent."
          )
          return
  
      if not _check_conditions(FLAGS.sigma2, num_classes, [order]):
          return  # Quit early: sufficient conditions for correctness fail to hold.
  
      (
          beta_opt,
          ss_opt,
          sigma_ss_opt,
      ) = _find_optimal_smooth_sensitivity_parameters(
          votes,
          baseline,
          num_teachers,
          FLAGS.threshold,
          FLAGS.sigma1,
          FLAGS.sigma2,
          FLAGS.delta,
          ind_step1,
          ind_step2,
          order,
      )
  
      print(
          "Optimal beta = {:.4f}, E[SS_beta] = {:.4}, sigma_ss = {:.2f}".format(
              beta_opt, ss_opt, sigma_ss_opt
          )
      )
  
file_path: privacy/research/pate_2018/ICLR2018/smooth_sensitivity_table.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 numpy
  import core
  import smooth_sensitivity
label_desc: Use image node_id 8 for calling a global function with example usage: main(argv) without return types