source: orange/orange/doc/reference/majority.py @ 526:fe2d65da2b2a

Revision 526:fe2d65da2b2a, 746 bytes checked in by janezd <janez.demsar@…>, 10 years ago (diff)
  • moved documentation from a separate module to this one
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.