code: def test_results(self):
      # empty sum evaluation
      e = OnsetSumEvaluation([])
      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.precision, 1)
      self.assertEqual(e.recall, 1)
      self.assertEqual(e.fmeasure, 1)
      self.assertEqual(e.accuracy, 1)
      self.assertTrue(np.allclose(e.errors, []))
      self.assertTrue(math.isnan(e.mean_error))
      self.assertTrue(math.isnan(e.std_error))
      # sum evaluation of empty onset evaluation
      e1 = OnsetEvaluation([], [])
      e = OnsetSumEvaluation([e1])
      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.precision, 1)
      self.assertEqual(e.recall, 1)
      self.assertEqual(e.fmeasure, 1)
      self.assertEqual(e.accuracy, 1)
      self.assertTrue(np.allclose(e.errors, []))
      self.assertTrue(math.isnan(e.mean_error))
      self.assertTrue(math.isnan(e.std_error))
      # sum evaluation of empty and real onset evaluation
      e2 = OnsetEvaluation(DETECTIONS, ANNOTATIONS)
      e = OnsetSumEvaluation([e1, e2])
      self.assertEqual(e.num_tp, 5)
      self.assertEqual(e.num_fp, 2)
      self.assertEqual(e.num_tn, 0)
      self.assertEqual(e.num_fn, 3)
      # p = correct / retrieved
      self.assertEqual(e.precision, 5.0 / 7.0)
      # r = correct / relevant
      self.assertEqual(e.recall, 5.0 / 8.0)
      # f = 2 * P * R / (P + R)
      f = 2 * (5.0 / 7.0) * (5.0 / 8.0) / ((5.0 / 7.0) + (5.0 / 8.0))
      self.assertEqual(e.fmeasure, f)
      # acc = (TP + TN) / (TP + FP + TN + FN)
      self.assertEqual(e.accuracy, (5.0 + 0) / (5 + 2 + 0 + 3))
      # errors is just a concatenation of all errors, i.e. those of e2
      self.assertTrue(np.allclose(e.errors, e2.errors))
      # thus mean and std of errors is those of e2
      self.assertEqual(e.mean_error, e2.mean_error)
      self.assertEqual(e.std_error, e2.std_error)
  
imports: from __future__ import absolute_import, division, print_function
  import math
  import unittest
  from madmom.evaluation.onsets import *
  from .None import ANNOTATIONS_PATH, DETECTIONS_PATH
label_desc: Use image node_id 2 for calling the TestOnsetSumEvaluationClass obj's underlying member method code with example usage: obj.test_results() without return types