def test_leave_one_out(self): fold = evaluation.kfold(self.corpus, self.problem, self.classifier, len(self.corpus)) self.assertNotEqual(fold, 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)
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)
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)