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

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

Tests moved and renamed from orange 20.

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.