def test_call(self): cv = testing.LeaveOneOut() nrows, ncols = 100, 10 t = random_data(nrows, ncols) res = cv(t, [naive_bayes.BayesLearner()]) y = t.Y np.testing.assert_equal(res.actual, y[res.row_indices].reshape(nrows)) np.testing.assert_equal(res.predicted[0], y[res.row_indices].reshape(nrows)) np.testing.assert_equal(np.argmax(res.probabilities[0], axis=1), y[res.row_indices].reshape(nrows))
def test_no_data(self): self.assertRaises(TypeError, testing.CrossValidation, fitters=[naive_bayes.BayesLearner()])