Esempio n. 1
0
print "\t"+"\t".join(classes[:-1])
for className, AUCrow in zip(classes[1:], AUCmatrix[1:]):
    print ("%s" + ("\t%5.3f" * len(AUCrow))) % ((className, ) + tuple(AUCrow))

print
print "AUCs for detecting various pairs of classes in 'vehicle'"
for c1, s1 in enumerate(classes):
    for c2 in range(c1):
        print "%s vs %s: \t%5.3f\t%5.3f\t%5.3f" % ((s1, classes[c2]) + tuple(orngStat.AUC_pair(resVeh, c1, c2)))


ri2 = orange.MakeRandomIndices2(voting, 0.6)
train = voting.selectref(ri2, 0)
test = voting.selectref(ri2, 1)
res1 = orngTest.learnAndTestOnTestData(learners, train, test)

print
print "AUC and SE for voting"
AUCs = orngStat.AUCWilcoxon(res1)
for li, lrn in enumerate(learners):
    print "%s: %5.3f+-%5.3f" % (lrn.name, AUCs[li][0], AUCs[li][1])

print
print "Difference between naive Bayes and tree: %5.3f+-%5.3f" % tuple(orngStat.compare2AUCs(res1, 0, 1)[2])

print
print "ROC (first 20 points) for bayes on 'voting'"
ROC_bayes = orngStat.computeROC(res1)[0]
for t in ROC_bayes[:20]:
    print "%5.3f\t%5.3f" % t
Esempio n. 2
0
    print "%s & %s & %5.3f & %5.3f & %i & %i & %i & %i & %5.3f & %5.3f & %5.3f & %s \\\\" % \
        (rowName, learners[index].name, CAs[index], APs[index], \
             CMs[index].TP, CMs[index].FP, CMs[index].FN, CMs[index].TN, \
             orngStat.sens(CMs[index]), orngStat.PPV(CMs[index]), orngStat.F1(CMs[index]), \
             roc)

minimalRows = 9
if (minimalRows - learnersCount) > 0:
    for _ in range(minimalRows - learnersCount):
        print ' &  &  &  &  &  &  &  &  &  &  &  \\\\'


iterations = orngStat.splitByIterations(result)
curves = []
for iteration in iterations:
    ROCs = orngStat.computeROC(iteration)
    for ROC in ROCs:
        curves.append(ROC)

for index in range(learnersCount):
    points = []
    for curve in range(index, len(curves), learnersCount):
        points.extend(curves[curve])
    x = map(lambda a: a[0], points)
    y = map(lambda a: a[1], points)

    mpl.plot(x, y, 'o', label=learners[index].name, alpha=0.5)
mpl.plot([0, 1], [0, 1], '--', color='grey')

# mpl.xlabel('1 - Specificity')
# mpl.ylabel('Sensitivity')