source: orange/docs/reference/rst/code/optimization-tuning1.py @ 10716:5d1600100484

Revision 10716:5d1600100484, 1.2 KB checked in by anze <anze.staric@…>, 2 years ago (diff)

Fixed failing tests.

Line 
1import Orange
2
3learner = Orange.classification.tree.TreeLearner()
4voting = Orange.data.Table("voting")
5tuner = Orange.tuning.Tune1Parameter(learner=learner,
6                           parameter="min_subset",
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.min_subset
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(min_subset=10).instance()
21voting = Orange.data.Table("voting")
22tuner = Orange.tuning.Tune1Parameter(learner=learner,
23                    parameter=["split.continuous_split_constructor.min_subset",
24                               "split.discrete_split_constructor.min_subset"],
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.continuous_split_constructor.min_subset
Note: See TracBrowser for help on using the repository browser.