source: orange/orange/doc/modules/ensemble4.py @ 3573:cce66748b0b9

Revision 3573:cce66748b0b9, 716 bytes checked in by markotoplak, 7 years ago (diff)

Added documentation and example for MeasureAttribute_randomForests.

Line 
1import orange, orngEnsemble, random
2
3data = orange.ExampleTable("iris.tab")
4
5measure = orngEnsemble.MeasureAttribute_randomForests(trees=100)
6
7#call by attribute index
8imp0 = measure(0, data) 
9#call by orange.Variable
10imp1 = measure(data.domain.attributes[1], data)
11print "first: %0.2f, second: %0.2f\n" % (imp0, imp1)
12
13print "different random seed"
14measure = orngEnsemble.MeasureAttribute_randomForests(trees=100, rand=random.Random(10))
15
16imp0 = measure(0, data)
17imp1 = measure(data.domain.attributes[1], data)
18print "first: %0.2f, second: %0.2f\n" % (imp0, imp1)
19
20print "All importances:"
21imps = measure.importances(data)
22for i,imp in enumerate(imps):
23  print "%15s: %6.2f" % (data.domain.attributes[i].name, imp)
Note: See TracBrowser for help on using the repository browser.