Example #1
0
 def test_best_threshold3(self):
     random.seed(hash("Son de plata y de acero, sivlerrrrhaaawks!"))
     real = [(i, i, random.random()) for i in xrange(100)]
     guess = random.sample(real, 50)
     real = [(a, b) for a, b, _ in real]
     best, _ = best_threshold(real, guess)
     for i in range(100):
         threshold = random.random()
         score = F_score(apply_threshold(guess, threshold), real)[0]
         self.assertLessEqual(score, best)
Example #2
0
 def test_best_threshold3(self):
     random.seed(hash("Son de plata y de acero, sivlerrrrhaaawks!"))
     real = [(i, i, random.random()) for i in xrange(100)]
     guess = random.sample(real, 50)
     real = [(a, b) for a, b, _ in real]
     best, _ = best_threshold(real, guess)
     for i in range(100):
         threshold = random.random()
         score = F_score(apply_threshold(guess, threshold), real)[0]
         self.assertLessEqual(score, best)
Example #3
0
 def test_best_threshold2(self):
     score, threshold = best_threshold([(0, 0)],
                                       [(0, 0, 0), (1, 1, 1)])
     self.assertLess(threshold, 1)
     self.assertGreater(score, 0)
Example #4
0
 def test_best_threshold1(self):
     best_threshold([], [(0, 0, 0), (1, 1, 1)])
Example #5
0
 def test_best_threshold2(self):
     score, threshold = best_threshold([(0, 0)], [(0, 0, 0), (1, 1, 1)])
     self.assertLess(threshold, 1)
     self.assertGreater(score, 0)
Example #6
0
 def test_best_threshold1(self):
     best_threshold([], [(0, 0, 0), (1, 1, 1)])