source: orange/docs/reference/rst/code/ensemble.py @ 9638:eb3af38491f2

Revision 9638:eb3af38491f2, 787 bytes checked in by umek@…, 2 years ago (diff)

Changed table to data or name of the data set.

For example - instead of

table = Orange.data.Table("housing")

is changed to

housing = Orange.data.Table("housing")

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
13lymphography = Orange.data.Table("lymphography.tab")
14
15learners = [tree, bs, bg]
16results = Orange.evaluation.testing.cross_validation(learners, lymphography, 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.