source: orange/docs/reference/rst/code/majority-classification.py @ 9372:aef193695ea9

Revision 9372:aef193695ea9, 830 bytes checked in by mitar, 2 years ago (diff)

Moved documentation to the separate directory.

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, Orange.evaluation.testing.cross_validation
4# Uses:        monks-1
5# Referenced:  majority.htm
6
7import Orange
8
9table = Orange.data.Table("monks-1")
10
11treeLearner = Orange.classification.tree.TreeLearner()
12bayesLearner = Orange.classification.bayes.NaiveLearner()
13majorityLearner = Orange.classification.majority.MajorityLearner()
14learners = [treeLearner, bayesLearner, majorityLearner]
15
16res = Orange.evaluation.testing.cross_validation(learners, table)
17CAs = Orange.evaluation.scoring.CA(res, reportSE=True)
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.