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

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

Tests moved and renamed from orange 20.

Line 
1import orange, orngTree, orngWrap, orngStat
2
3learner = orngTree.TreeLearner()
4data = orange.ExampleTable("voting")
5tuner = orngWrap.Tune1Parameter(object=learner,
6                                parameter="minSubset",
7                                values=[1, 2, 3, 4, 5, 10, 15, 20],
8                                evaluate = orngStat.AUC, verbose=2)
9classifier = tuner(data)
10
11print "Optimal setting: ", learner.minSubset
12
13import orngTest
14untuned = orngTree.TreeLearner()
15res = orngTest.crossValidation([untuned, tuner], data)
16AUCs = orngStat.AUC(res)
17
18print "Untuned tree: %5.3f" % AUCs[0]
19print "Tuned tree: %5.3f" % AUCs[1]
20
21
22learner = orngTree.TreeLearner(minSubset=10).instance()
23data = orange.ExampleTable("voting")
24tuner = orngWrap.Tune1Parameter(object=learner,
25                                parameter=["split.continuousSplitConstructor.minSubset", "split.discreteSplitConstructor.minSubset"],
26                                values=[1, 2, 3, 4, 5, 10, 15, 20],
27                                evaluate = orngStat.AUC, verbose=2)
28classifier = tuner(data)
29
30print "Optimal setting: ", learner.split.continuousSplitConstructor.minSubset
Note: See TracBrowser for help on using the repository browser.