source: orange/Orange/testing/regression/tests_20/modules_thresholding2.py @ 9952:986e9cd806f4

Revision 9952:986e9cd806f4, 503 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Tests moved and renamed from orange 20.

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.