source: orange/docs/reference/rst/code/ensemble.py @ 9372:aef193695ea9

Revision 9372:aef193695ea9, 773 bytes checked in by mitar, 2 years ago (diff)

Moved documentation to the separate directory.

Line 
1# Description: Demonstrates the use of boosting and bagging from Orange.ensemble module
2# Category:    classification, ensembles
3# Classes:     BoostedLearner, BaggedLearner
4# Uses:        lymphography.tab
5# Referenced:  orngEnsemble.htm
6
7import Orange
8
9tree = Orange.classification.tree.TreeLearner(m_pruning=2, name="tree")
10bs = Orange.ensemble.boosting.BoostedLearner(tree, name="boosted tree")
11bg = Orange.ensemble.bagging.BaggedLearner(tree, name="bagged tree")
12
13table = Orange.data.Table("lymphography.tab")
14
15learners = [tree, bs, bg]
16results = Orange.evaluation.testing.cross_validation(learners, table, folds=3)
17print "Classification Accuracy:"
18for i in range(len(learners)):
19    print ("%15s: %5.3f") % (learners[i].name, Orange.evaluation.scoring.CA(results)[i])
Note: See TracBrowser for help on using the repository browser.