source: orange/Orange/doc/modules/ensemble4.py @ 9671:a7b056375472

Revision 9671:a7b056375472, 716 bytes checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

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.