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

Revision 9823:7f9c3f3c6474, 545 bytes 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
3bupa = Orange.data.Table("bupa")
4ri2 = Orange.core.MakeRandomIndices2(bupa, 0.7)
5train = bupa.select(ri2, 0)
6test = bupa.select(ri2, 1)
7
8bayes = Orange.classification.bayes.NaiveLearner(train)
9
10thresholds = [.2, .5, .8]
11models = [Orange.optimization.ThresholdClassifier(bayes, thr) for thr in thresholds]
12
13res = Orange.evaluation.testing.test_on_data(models, test)
14cm = Orange.evaluation.scoring.confusion_matrices(res)
15
16print
17for i, thr in enumerate(thresholds):
18    print "%1.2f: TP %5.3f, TN %5.3f" % (thr, cm[i].TP, cm[i].TN)
Note: See TracBrowser for help on using the repository browser.