code: def do_plot(
      fn,
      keep,
      scores,
      ntest,
      legend="",
      metric="auc",
      sweep_fn=sweep,
      **plot_kwargs,
  ):
      """
      Generate the ROC curves by using ntest models as test models and the rest to train.
      """
  
      prediction, answers = fn(
          keep[:-ntest], scores[:-ntest], keep[-ntest:], scores[-ntest:]
      )
  
      fpr, tpr, auc, acc = sweep_fn(
          np.array(prediction), np.array(answers, dtype=bool)
      )
  
      low = tpr[np.where(fpr < 0.001)[0][-1]]
  
      print(
          "Attack %s   AUC %.4f, Accuracy %.4f, TPR@0.1%%FPR of %.4f"
          % (legend, auc, acc, low)
      )
  
      metric_text = ""
      if metric == "auc":
          metric_text = "auc=%.3f" % auc
      elif metric == "acc":
          metric_text = "acc=%.3f" % acc
  
      plt.plot(fpr, tpr, label=legend + metric_text, **plot_kwargs)
      return (acc, auc)
  
file_path: privacy/research/mi_lira_2021/plot.py
imports: import os
  import scipy.stats
  import numpy
  import matplotlib.pyplot
  from sklearn.metrics import auc, roc_curve
  import functools
  import matplotlib
label_desc: Use image node_id 6 for calling a global function with example usage: do_plot(fn, keep, scores, ntest, legend, metric, sweep_fn) and returns: acc,  auc