source: orange/docs/tutorial/rst/code/accuracy7.py @ 9374:59bac7ddd8a2

Revision 9374:59bac7ddd8a2, 834 bytes checked in by mitar, 2 years ago (diff)

Tutorial documentation structure.

Line 
1# Description: Demostration of use of cross-validation as provided in orngEval module
2# Category:    evaluation
3# Uses:        voting.tab
4# Classes:     orngTest.crossValidation
5# Referenced:  c_performance.htm
6
7import orange, orngTest, orngStat, orngTree
8
9# set up the learners
10bayes = orange.BayesLearner()
11tree = orngTree.TreeLearner(mForPruning=2)
12bayes.name = "bayes"
13tree.name = "tree"
14learners = [bayes, tree]
15
16# compute accuracies on data
17data = orange.ExampleTable("voting")
18results = orngTest.crossValidation(learners, data, folds=10)
19
20# output the results
21print "Learner  CA     IS     Brier    AUC"
22for i in range(len(learners)):
23    print "%-8s %5.3f  %5.3f  %5.3f  %5.3f" % (learners[i].name, \
24        orngStat.CA(results)[i], orngStat.IS(results)[i],
25        orngStat.BrierScore(results)[i], orngStat.AUC(results)[i])
Note: See TracBrowser for help on using the repository browser.