code: def sens_at_k(counts, noise_eps, l, k):
      """Return sensitivity at distane k.
  
      Args:
        counts: an array of scores
        noise_eps: noise parameter used
        l: moment whose sensitivity is being computed
        k: distance
      Returns:
        sensitivity: at distance k
      """
      counts_sorted = sorted(counts, reverse=True)
      if 0.5 * noise_eps * l > 1:
          print("l too large to compute sensitivity")
          return 0
      # Now we can assume that at k, gap remains positive
      # or we have reached the point where logmgf_exact is
      # determined by the first term and ind of q.
      if counts[0] < counts[1] + k:
          return 0
      counts_sorted[0] -= k
      counts_sorted[1] += k
      val = logmgf_from_counts(counts_sorted, noise_eps, l)
      counts_sorted[0] -= 1
      counts_sorted[1] += 1
      val_changed = logmgf_from_counts(counts_sorted, noise_eps, l)
      return val_changed - val
  
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 5 for calling a global function with example usage: sens_at_k(counts, noise_eps, l, k) and returns: unknown, int, int