code: def test_results(self):
      # empty detections / annotations
      e = OnsetEvaluation([], [])
      self.assertTrue(np.allclose(e.tp, []))
      self.assertTrue(np.allclose(e.fp, []))
      self.assertTrue(np.allclose(e.tn, []))
      self.assertTrue(np.allclose(e.fn, []))
      self.assertTrue(np.allclose(e.errors, []))
      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))
  
      # real detections / annotations
      e = OnsetEvaluation(DETECTIONS, ANNOTATIONS)
      self.assertTrue(
          np.allclose(e.tp, [0.99999, 1.02999, 2.01, 2.02, 2.5])
      )
      self.assertTrue(np.allclose(e.fp, [1.45, 3.025000001]))
      self.assertTrue(np.allclose(e.tn, []))
      self.assertTrue(np.allclose(e.fn, [1.5, 2.05, 3.0]))
      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
      # det 0.99999999, 1.02999999, 1.45, 2.01, 2.02,       2.5, 3.030000001
      # tar 1,          1.02,       1.5,  2.0,  2.03, 2.05, 2.5, 3
      errors = [
          0.99999999 - 1,
          1.02999999 - 1.02,  # 1.45 - 1.5,
          2.01 - 2,
          2.02 - 2.03,
          2.5 - 2.5,
      ]  # , 3.030000001 - 3
      self.assertTrue(np.allclose(e.errors, errors))
      mean = np.mean(
          [
              0.99999999 - 1,
              1.02999999 - 1.02,
              2.01 - 2,
              2.02 - 2.03,
              2.5 - 2.5,
          ]
      )
      self.assertEqual(e.mean_error, mean)
      std = np.std(
          [
              0.99999999 - 1,
              1.02999999 - 1.02,
              2.01 - 2,
              2.02 - 2.03,
              2.5 - 2.5,
          ]
      )
      self.assertEqual(e.std_error, std)
  
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 3 for calling the TestOnsetEvaluationClass obj's underlying member method code with example usage: obj.test_results() without return types