source: orange/docs/tutorial/rst/code/bagging_test.py @ 11051:04009d17e84e

Revision 11051:04009d17e84e, 643 bytes checked in by blaz <blaz.zupan@…>, 16 months ago (diff)

new tutorial

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 bagging
8import Orange
9data = Orange.data.Table("adult_sample.tab")
10
11tree = Orange.classification.tree.TreeLearner(mForPrunning=10, minExamples=30)
12tree.name = "tree"
13baggedTree = bagging.Learner(learner=tree, t=5)
14
15learners = [tree, baggedTree]
16
17results = Orange.evaluation.testing.cross_validation(learners, data, folds=5)
18for i in range(len(learners)):
19    print "%s: %5.3f" % (learners[i].name, Orange.evaluation.scoring.CA(results)[i])
Note: See TracBrowser for help on using the repository browser.