Esempio n. 1
0
 def test_minimize_error_count(self):
     """minimize_error_count should return correct classifier"""
     first = array([2,1,5,3,5])
     second = array([2,5,5,4,6,7])
     c = classifiers(first, second)
     exp = (4,False,1,2,3,5)
     self.assertEqual(minimize_error_count(c), exp)
Esempio n. 2
0
 def test_minimize_error_rate(self):
     """minimize_error_rate should return correct classifier"""
     #should be same as error count on example used above
     first = array([2,1,5,3,5])
     second = array([2,5,5,4,6,7])
     c = classifiers(first, second)
     exp = (4,False,1,2,3,5)
     self.assertEqual(minimize_error_rate(c), exp)
     #here's a case where they should differ
     first = array([2,3,11,5])
     second = array([1,4,6,7,8,9,10])
     c = classifiers(first, second)
     self.assertEqual(minimize_error_count(c), (3,False,1,2,2,6))
     self.assertEqual(minimize_error_rate(c), (5,False,2,1,3,5))