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

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

Moved orange to Orange (part 2)

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.