source: orange/Orange/testing/regression/tests_20/modules_ensemble2.py @ 9952:986e9cd806f4

Revision 9952:986e9cd806f4, 834 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Tests moved and renamed from orange 20.

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.