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

Revision 9638:eb3af38491f2, 611 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: Defines a tree learner (trunks of depth less than 5) and uses them in forest tree, prints out the number of nodes in each tree
2# Category:    classification, ensembles
3# Classes:     RandomForestLearner
4# Uses:        bupa.tab
5# Referenced:  orngEnsemble.htm
6
7import Orange
8
9bupa = Orange.data.Table('bupa.tab')
10
11tree = Orange.classification.tree.TreeLearner()
12tree.minExamples = 5
13tree.maxDepth = 5
14
15forest_learner = Orange.ensemble.forest.RandomForestLearner(base_learner=tree, trees=50, attributes=3)
16forest = forest_learner(bupa)
17
18for c in forest.classifiers:
19    print c.countNodes(),
20print
Note: See TracBrowser for help on using the repository browser.