示例#1
0
 def test_leave_one_out(self):
     fold = evaluation.kfold(self.corpus, self.problem,
                             self.classifier, len(self.corpus))
     self.assertNotEqual(fold, 0)
示例#2
0
 def test_kfold_lt_75(self):
     testset = [(1, 0, 0), (1, 0, 1), (1, 1, 0), (0, 1, 1)]
     self.my_setup(testset)
     p = kfold(testset, self.p, MockClassifier, k=4)
     self.assertLessEqual(p, 0.75)
示例#3
0
 def test_leave_one_out(self):
     fold = evaluation.kfold(self.corpus, self.problem, self.classifier,
                             len(self.corpus))
     self.assertNotEqual(fold, 0)
示例#4
0
 def test_kfold_is_0(self):
     testset = [(0, 1, 1), (1, 1, 0)]
     self.my_setup(testset)
     p = kfold(testset, self.p, MockClassifier, k=2)
     self.assertEqual(p, 0.0)
示例#5
0
 def test_k1_is_bad(self):
     testset = [(0, 1, 1), (1, 1, 0), (1, 6, 5), (1, 7, 0), (0, 1, 9)]
     self.my_setup(testset)
     with self.assertRaises(ValueError):
         kfold(testset, self.p, MockClassifier, k=1)
示例#6
0
 def test_kfold_lt_75(self):
     testset = [(1, 0, 0), (1, 0, 1), (1, 1, 0), (0, 1, 1)]
     self.my_setup(testset)
     p = kfold(testset, self.p, MockClassifier, k=4)
     self.assertLessEqual(p, 0.75)
示例#7
0
 def test_kfold_is_0(self):
     testset = [(0, 1, 1), (1, 1, 0)]
     self.my_setup(testset)
     p = kfold(testset, self.p, MockClassifier, k=2)
     self.assertEqual(p, 0.0)
示例#8
0
 def test_k1_is_bad(self):
     testset = [(0, 1, 1), (1, 1, 0), (1, 6, 5), (1, 7, 0), (0, 1, 9)]
     self.my_setup(testset)
     with self.assertRaises(ValueError):
         kfold(testset, self.p, MockClassifier, k=1)