예제 #1
0
 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])
예제 #2
0
 def test_adaboost_adequacy(self):
     learner = SklAdaBoostLearner()
     self.assertRaises(ValueError, learner, self.housing)
예제 #3
0
 def test_predict_numpy(self):
     learn = SklAdaBoostLearner()
     m = learn(self.iris)
     _, _ = m(self.iris.X, m.ValueProbs)
예제 #4
0
 def test_predict_table(self):
     learn = SklAdaBoostLearner()
     m = learn(self.iris)
     m(self.iris)
     _, _ = m(self.iris, m.ValueProbs)
예제 #5
0
 def test_predict_single_instance(self):
     learn = SklAdaBoostLearner()
     m = learn(self.iris)
     ins = self.iris[0]
     m(ins)
     _, _ = m(ins, m.ValueProbs)
예제 #6
0
 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)