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

Revision 9952:986e9cd806f4, 746 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 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.