code: def print_stats(correctness, confidence, name):
      """
      Prints out accuracy, coverage, etc. statistics
      :param correctness: ndarray
        One bool per example specifying whether it was correctly classified
      :param confidence: ndarray
        The probability associated with each prediction
      :param name: str
        The name of this type of data (e.g. "clean", "MaxConfidence")
      """
      accuracy = correctness.mean()
      wrongness = 1 - correctness
      denom1 = np.maximum(1, wrongness.sum())
      ave_prob_on_mistake = (wrongness * confidence).sum() / denom1
      assert ave_prob_on_mistake <= 1.0, ave_prob_on_mistake
      denom2 = np.maximum(1, correctness.sum())
      ave_prob_on_correct = (correctness * confidence).sum() / denom2
      covered = confidence > 0.5
      cov_half = covered.mean()
      acc_half = (correctness * covered).sum() / np.maximum(
          1, covered.sum()
      )
      print("Accuracy on %s examples: %0.4f" % (name, accuracy))
      print("Average prob on mistakes: %0.4f" % ave_prob_on_mistake)
      print("Average prob on correct: %0.4f" % ave_prob_on_correct)
      print("Accuracy when prob thresholded at .5: %0.4f" % acc_half)
      print("Coverage when prob thresholded at .5: %0.4f" % cov_half)
  
      success_rate = acc_half * cov_half
      # Success is correctly classifying a covered example
      print("Success rate at .5: %0.4f" % success_rate)
      # Failure is misclassifying a covered example
      failure_rate = (1.0 - acc_half) * cov_half
      print("Failure rate at .5: %0.4f" % failure_rate)
      print()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from collections import OrderedDict
  import logging
  import time
  import warnings
  import numpy
  import six
  import tensorflow
  from cleverhans.attacks import MaxConfidence
  from cleverhans.attacks import Semantic
  from cleverhans.evaluation import correctness_and_confidence
  from cleverhans.evaluation import run_attack
  from cleverhans.utils import set_log_level
  from cleverhans.serial import load, save
  from cleverhans.utils_tf import infer_devices
label_desc: Use image node_id 2 for calling a global function with example usage: print_stats(correctness, confidence, name) without return types