code: def test_results(self):
      # empty evaluation object
      e = SimpleEvaluation()
      self.assertEqual(e.num_tp, 0)
      self.assertEqual(e.num_fp, 0)
      self.assertEqual(e.num_tn, 0)
      self.assertEqual(e.num_fn, 0)
      self.assertEqual(e.num_annotations, 0)
      self.assertEqual(len(e), 0)
      # all correct (none) retrieved
      self.assertEqual(e.precision, 1)
      # all retrieved (none) are correct
      self.assertEqual(e.recall, 1)
      # 2 * P * R / (P + R)
      self.assertEqual(e.fmeasure, 1)
      # (TP + TN) / (TP + FP + TN + FN)
      self.assertEqual(e.accuracy, 1)
      # metric dictionary
      self.assertEqual(
          list(e.metrics.keys()),
          [
              "num_tp",
              "num_fp",
              "num_tn",
              "num_fn",
              "num_annotations",
              "precision",
              "recall",
              "fmeasure",
              "accuracy",
          ],
      )
      correct = OrderedDict(
          [
              ("num_tp", 0),
              ("num_fp", 0),
              ("num_tn", 0),
              ("num_fn", 0),
              ("num_annotations", 0),
              ("precision", 1.0),
              ("recall", 1.0),
              ("fmeasure", 1.0),
              ("accuracy", 1.0),
          ]
      )
      self.assertEqual(e.metrics, correct)
  
      # test with other values
      e = SimpleEvaluation(num_tp=5, num_fp=3, num_tn=4, num_fn=1)
      self.assertEqual(e.num_tp, 5)
      self.assertEqual(e.num_fp, 3)
      self.assertEqual(e.num_tn, 4)
      self.assertEqual(e.num_fn, 1)
      self.assertEqual(e.num_annotations, 6)
      self.assertEqual(len(e), 6)
      # correct / retrieved
      self.assertEqual(e.precision, 5.0 / 8.0)
      # correct / relevant
      self.assertEqual(e.recall, 5.0 / 6.0)
      # 2 * P * R / (P + R)
      f = 2 * (5.0 / 8.0) * (5.0 / 6.0) / ((5.0 / 8.0) + (5.0 / 6.0))
      self.assertEqual(e.fmeasure, f)
      # (TP + TN) / (TP + FP + TN + FN)
      self.assertEqual(e.accuracy, (5.0 + 4) / (5 + 3 + 4 + 1))
  
      # test with no true positives/negatives
      e = SimpleEvaluation(num_tp=0, num_fp=3, num_tn=0, num_fn=1)
      self.assertEqual(e.num_tp, 0)
      self.assertEqual(e.num_fp, 3)
      self.assertEqual(e.num_tn, 0)
      self.assertEqual(e.num_fn, 1)
      self.assertEqual(e.num_annotations, 1)
      self.assertEqual(len(e), 1)
      self.assertEqual(e.precision, 0)
      self.assertEqual(e.recall, 0)
      self.assertEqual(e.fmeasure, 0)
      self.assertEqual(e.accuracy, 0)
  
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 TestSimpleEvaluationClass obj's underlying member method code with example usage: obj.test_results() without return types