source: orange/Orange/doc/modules/ensemble.py @ 9671:a7b056375472

Revision 9671:a7b056375472, 746 bytes checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

Line 
1# Description: Demonstrates the use of boosting and bagging from orngEnsemble module
2# Category:    classification, ensembles
3# Classes:     BoostedLearner, BaggedLearner
4# Uses:        lymphography.tab
5# Referenced:  orngEnsemble.htm
6
7import orange, orngEnsemble, orngTree
8import orngTest, orngStat
9
10tree = orngTree.TreeLearner(mForPruning=2, name="tree")
11bs = orngEnsemble.BoostedLearner(tree, name="boosted tree")
12bg = orngEnsemble.BaggedLearner(tree, name="bagged tree")
13
14data = orange.ExampleTable("lymphography.tab")
15
16learners = [tree, bs, bg]
17results = orngTest.crossValidation(learners, data, folds=3)
18print "Classification Accuracy:"
19for i in range(len(learners)):
20    print ("%15s: %5.3f") % (learners[i].name, orngStat.CA(results)[i])
Note: See TracBrowser for help on using the repository browser.