source: orange/docs/reference/rst/code/ensemble-stacking.py @ 10540:788913064426

Revision 10540:788913064426, 630 bytes checked in by blaz <blaz.zupan@…>, 2 years ago (diff)

Added stacking (ensemble method).

Line 
1import Orange
2
3data = Orange.data.Table("promoters")
4
5bayes = Orange.classification.bayes.NaiveLearner(name="bayes")
6tree = Orange.classification.tree.SimpleTreeLearner(name="tree")
7lin = Orange.classification.svm.LinearLearner(name="lr")
8knn = Orange.classification.knn.kNNLearner(name="knn")
9
10base_learners = [bayes, tree, lin, knn]
11stack = Orange.ensemble.stacking.StackedClassificationLearner(base_learners)
12
13learners = [stack, bayes, tree, lin, knn]
14res = Orange.evaluation.testing.cross_validation(learners, data, 3)
15print "\n".join(["%8s: %5.3f" % (l.name, r) for r, l in zip(Orange.evaluation.scoring.CA(res), learners)])
Note: See TracBrowser for help on using the repository browser.