def test_adaboost_base_estimator(self): np.random.seed(0) stump_estimator = TreeLearner(max_depth=1) tree_estimator = TreeLearner() stump = SklAdaBoostLearner(base_estimator=stump_estimator) tree = SklAdaBoostLearner(base_estimator=tree_estimator) results = CrossValidation(self.iris, [stump, tree], k=4) ca = CA(results) self.assertLess(ca[0], ca[1])
def test_adaboost_adequacy(self): learner = SklAdaBoostLearner() self.assertRaises(ValueError, learner, self.housing)
def test_predict_numpy(self): learn = SklAdaBoostLearner() m = learn(self.iris) _, _ = m(self.iris.X, m.ValueProbs)
def test_predict_table(self): learn = SklAdaBoostLearner() m = learn(self.iris) m(self.iris) _, _ = m(self.iris, m.ValueProbs)
def test_predict_single_instance(self): learn = SklAdaBoostLearner() m = learn(self.iris) ins = self.iris[0] m(ins) _, _ = m(ins, m.ValueProbs)
def test_adaboost(self): learn = SklAdaBoostLearner() results = CrossValidation(self.iris, [learn], k=3) ca = CA(results) self.assertGreater(ca, 0.9) self.assertLess(ca, 0.99)