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

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

Moved orange to Orange (part 2)

Line 
1import orange, orngWrap, orngTest, orngStat
2
3data = orange.ExampleTable("bupa")
4ri2 = orange.MakeRandomIndices2(data, 0.7)
5train = data.select(ri2, 0)
6test = data.select(ri2, 1)
7
8bayes = orange.BayesLearner(train)
9
10thresholds = [.2, .5, .8]
11models = [orngWrap.ThresholdClassifier(bayes, thr) for thr in thresholds]
12
13res = orngTest.testOnData(models, test)
14cm = orngStat.confusionMatrices(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.