How to use the simpleai.machine_learning.evaluation.kfold function in simpleai

To help you get started, we’ve selected a few simpleai examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github simpleai-team / simpleai / tests / machine_learning / test_evaluation.py View on Github external
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)
github simpleai-team / simpleai / tests / machine_learning / test_evaluation.py View on Github external
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)
github simpleai-team / simpleai / tests / machine_learning / test_classifiers.py View on Github external
def test_leave_one_out(self):
        fold = evaluation.kfold(self.corpus, self.problem,
                                self.classifier, len(self.corpus))
        self.assertNotEqual(fold, 0)
github simpleai-team / simpleai / tests / machine_learning / test_evaluation.py View on Github external
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)