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