source: orange/docs/reference/rst/code/optimization-tuning1.py @ 9823:7f9c3f3c6474

Revision 9823:7f9c3f3c6474, 1.2 KB checked in by lanumek, 2 years ago (diff)

Changed names of data sets (table replaced with data or name of the data set).

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