Пример #1
0
 def test_no_tp_at_50(self):
     y_true = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
     y_score = np.array([1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1])
     tps = tp_at(y_true, y_score, proportion=0.5)
     self.assertEqual(tps, 0)
Пример #2
0
 def test_some_tp_at_100(self):
     y_true = np.array([0, 0, 0, 0, 1, 0, 0, 1, 1, 1])
     y_score = np.array([1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1])
     tps = tp_at(y_true, y_score, proportion=1.0)
     self.assertEqual(tps, 4)
Пример #3
0
 def test_all_tp_at_10(self):
     y_true = np.array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
     y_score = np.array([1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1])
     tps = tp_at(y_true, y_score, proportion=0.1)
     self.assertEqual(tps, 1)
Пример #4
0
 def test_with_nas(self):
     y_true = np.array([1, nan, 1, 1, 1, 1, 1, 1, 1, nan])
     y_score = np.array([1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1])
     tps = tp_at(y_true, y_score, top_proportion=0.1)
     self.assertEqual(tps, 1)
Пример #5
0
 def test_some_tp_at_100(self):
     y_true = np.array([0, 0, 0, 0, 1, 0, 0, 1, 1, 1])
     y_score = np.array([1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1])
     tps = tp_at(y_true, y_score, proportion=1.0)
     self.assertEqual(tps, 4)
Пример #6
0
 def test_no_tp_at_50(self):
     y_true = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
     y_score = np.array([1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1])
     tps = tp_at(y_true, y_score, proportion=0.5)
     self.assertEqual(tps, 0)
Пример #7
0
 def test_all_tp_at_10(self):
     y_true = np.array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
     y_score = np.array([1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1])
     tps = tp_at(y_true, y_score, proportion=0.1)
     self.assertEqual(tps, 1)