code: def test_results(self):
      # empty evaluation object
      e = Evaluation()
      self.assertTrue(np.allclose(e.tp, np.empty(0)))
      self.assertTrue(np.allclose(e.fp, np.empty(0)))
      self.assertTrue(np.allclose(e.tn, np.empty(0)))
      self.assertTrue(np.allclose(e.fn, np.empty(0)))
      self.assertEqual(e.num_tp, 0)
      self.assertEqual(e.num_fp, 0)
      self.assertEqual(e.num_tn, 0)
      self.assertEqual(e.num_fn, 0)
      # p: all correct (none) retrieved
      self.assertEqual(e.precision, 1)
      # r: all retrieved (none) are correct
      self.assertEqual(e.recall, 1)
      # f: 2 * P * R / (P + R)
      self.assertEqual(e.fmeasure, 1)
      # acc: (TP + TN) / (TP + FP + TN + FN)
      self.assertEqual(e.accuracy, 1)
      # test metric dictionary keys
      self.assertEqual(
          list(e.metrics.keys()),
          [
              "num_tp",
              "num_fp",
              "num_tn",
              "num_fn",
              "num_annotations",
              "precision",
              "recall",
              "fmeasure",
              "accuracy",
          ],
      )
      # test with other values
      e = Evaluation(tp=[1, 2, 3.0], fp=[1.5], fn=[0, 3.1])
      tp = np.asarray([1, 2, 3], dtype=float)
      self.assertTrue(np.allclose(e.tp, tp))
      fp = np.asarray([1.5], dtype=float)
      self.assertTrue(np.allclose(e.fp, fp))
      tn = np.asarray([], dtype=float)
      self.assertTrue(np.allclose(e.tn, tn))
      fn = np.asarray([0, 3.1], dtype=float)
      self.assertTrue(np.allclose(e.fn, fn))
      self.assertEqual(e.num_tp, 3)
      self.assertEqual(e.num_fp, 1)
      self.assertEqual(e.num_tn, 0)
      self.assertEqual(e.num_fn, 2)
      # p: correct / retrieved
      self.assertEqual(e.precision, 3.0 / 4.0)
      # r: correct / relevant
      self.assertEqual(e.recall, 3.0 / 5.0)
      # f: 2 * P * R / (P + R)
      f = 2 * (3.0 / 4.0) * (3.0 / 5.0) / ((3.0 / 4.0) + (3.0 / 5.0))
      self.assertEqual(e.fmeasure, f)
      # acc: (TP + TN) / (TP + FP + TN + FN)
      self.assertEqual(e.accuracy, 3.0 / (3 + 1 + 2))
  
imports: from __future__ import absolute_import, division, print_function
  import math
  import unittest
  from collections import OrderedDict
  from madmom.evaluation import *
label_desc: Use image node_id 3 for calling the TestEvaluationClass obj's underlying member method code with example usage: obj.test_results() without return types