docstr: Print stats and example failures
  
  Parameters
  ----------
  n : int
      number of example failures to show
  print_fn : function
      If not None, use this to print a failed test case.
      Arguments: (xs, preds, confs, expect_results, labels=None, meta=None)
  format_example_fn : function
      If not None, use this to print a failed example within a test case
      Arguments: (x, pred, conf, label=None, meta=None)
  n_per_testcase : int
      Maximum number of examples to show for each test case
docstr_tok: ["Print","stats","and","example","failures","Parameters","--","--","--","--","--","n",":","int","number","of","example","failures","to","show","print_fn",":","function","If","not","None",",","use","this","to","print","a","failed","test","case",".","Arguments",":","(","xs",",","preds",",","confs",",","expect_results",",","labels=None",",","meta=None",")","format_example_fn",":","function","If","not","None",",","use","this","to","print","a","failed","example","within","a","test","case","Arguments",":","(","x",",","pred",",","conf",",","label=None",",","meta=None",")","n_per_testcase",":","int","Maximum","number","of","examples","to","show","for","each","test","case"]
code: def summary(
      self, n=3, print_fn=None, format_example_fn=None, n_per_testcase=3
  ):
      """Print stats and example failures
  
      Parameters
      ----------
      n : int
          number of example failures to show
      print_fn : function
          If not None, use this to print a failed test case.
          Arguments: (xs, preds, confs, expect_results, labels=None, meta=None)
      format_example_fn : function
          If not None, use this to print a failed example within a test case
          Arguments: (x, pred, conf, label=None, meta=None)
      n_per_testcase : int
          Maximum number of examples to show for each test case
      """
      self.print_stats()
      if not n:
          return
      if print_fn is None:
          print_fn = self.print
  
      def default_format_example(x, pred, conf, *args, **kwargs):
          softmax = type(conf) in [np.array, np.ndarray]
          binary = False
          if softmax:
              if conf.shape[0] == 2:
                  conf = conf[1]
                  return "%.1f %s" % (conf, str(x))
              elif conf.shape[0] <= 4:
                  confs = " ".join(["%.1f" % c for c in conf])
                  return "%s %s" % (confs, str(x))
              else:
                  conf = conf[pred]
                  return "%s (%.1f) %s" % (pred, conf, str(x))
          else:
              return "%s %s" % (pred, str(x))
  
      if format_example_fn is None:
          format_example_fn = default_format_example
      fails = self.fail_idxs()
      if fails.shape[0] == 0:
          return
      print()
      print("Example fails:")
      fails = np.random.choice(
          fails, min(fails.shape[0], n), replace=False
      )
      for f in fails:
          d_idx = f if self.run_idxs is None else self.run_idxs[f]
          # should be format_fn
          label, meta = self._label_meta(d_idx)
          # print(label, meta)
          print_fn(
              self.data[d_idx],
              self.results.preds[d_idx],
              self.results.confs[d_idx],
              self.results.expect_results[f],
              label,
              meta,
              format_example_fn,
              nsamples=n_per_testcase,
          )
  
imports: from abc import ABC, abstractmethod
  import dill
  from munch import Munch
  import numpy
  import inspect
  from .expect import iter_with_optional, Expect
  from .viewer.test_summarizer import TestSummarizer
label_desc: Use image node_id 24 for calling the AbstractTest obj's underlying member method code with example usage: obj.summary(n, print_fn, format_example_fn, n_per_testcase) and returns: unknown, unknown, unknown, unknown