source: orange/Orange/testing/regression/tests_20/modules_ensemble4.py @ 9952:986e9cd806f4

Revision 9952:986e9cd806f4, 716 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Tests moved and renamed from orange 20.

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.