source: orange/docs/tutorial/rst/code/bagging_test.py @ 9374:59bac7ddd8a2

Revision 9374:59bac7ddd8a2, 637 bytes checked in by mitar, 2 years ago (diff)

Tutorial documentation structure.

Line 
1# Description: Test for bagging as defined in bagging.py
2# Category:    modelling
3# Uses:        adult_sample.tab, bagging.py
4# Referenced:  c_bagging.htm
5# Classes:     orngTest.crossValidation
6
7import orange, orngTree, orngStat, orngTest, orngStat, bagging
8data = orange.ExampleTable("../../datasets/adult_sample")
9
10tree = orngTree.TreeLearner(mForPrunning=10, minExamples=30)
11tree.name = "tree"
12baggedTree = bagging.Learner(learner=tree, t=5)
13
14learners = [tree, baggedTree]
15
16results = orngTest.crossValidation(learners, data, folds=5)
17for i in range(len(learners)):
18    print "%s: %5.3f" % (learners[i].name, orngStat.CA(results)[i])
Note: See TracBrowser for help on using the repository browser.