source: orange/Orange/doc/reference/majority.py @ 9671:a7b056375472

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

Moved orange to Orange (part 2)

Line 
1# Description: Shows how to "learn" the majority class and compare other classifiers to the default classification
2# Category:    default classification accuracy, statistics
3# Classes:     MajorityLearner, DefaultClassifier, orngTest.crossValidation
4# Uses:        monk1
5# Referenced:  majority.htm
6
7import orange, orngTest, orngStat
8
9data = orange.ExampleTable("monk1")
10
11treeLearner = orange.TreeLearner()
12bayesLearner = orange.BayesLearner()
13majorityLearner = orange.MajorityLearner()
14learners = [treeLearner, bayesLearner, majorityLearner]
15
16res = orngTest.crossValidation(learners, data)
17CAs = orngStat.CA(res, reportSE = 1)
18
19print "Tree:    %5.3f+-%5.3f" % CAs[0]
20print "Bayes:   %5.3f+-%5.3f" % CAs[1]
21print "Default: %5.3f+-%5.3f" % CAs[2]
Note: See TracBrowser for help on using the repository browser.