source: orange/orange/doc/modules/ensemble2.py @ 9317:6341e2ee5017

Revision 9317:6341e2ee5017, 834 bytes checked in by markotoplak, 2 years ago (diff)

Random forest: changed constructor arguments.

Line 
1# Description: Demonstrates the use of random forests from orngEnsemble module
2# Category:    classification, ensembles
3# Classes:     RandomForestLearner
4# Uses:        bupa.tab
5# Referenced:  orngEnsemble.htm
6
7import orange, orngTree, orngEnsemble
8
9data = orange.ExampleTable('bupa.tab')
10tree = orngTree.TreeLearner(minExamples=2, mForPrunning=2, \
11                            sameMajorityPruning=True, name='tree')
12forest = orngEnsemble.RandomForestLearner(trees=50, name="forest")
13learners = [tree, forest]
14
15import orngTest, orngStat
16results = orngTest.crossValidation(learners, data, folds=3)
17print "Learner  CA     Brier  AUC"
18for i in range(len(learners)):
19    print "%-8s %5.3f  %5.3f  %5.3f" % (learners[i].name, \
20        orngStat.CA(results)[i], 
21        orngStat.BrierScore(results)[i],
22        orngStat.AUC(results)[i])
23
Note: See TracBrowser for help on using the repository browser.