This is documentation for Orange 2.7. For the latest documentation, see Orange 3.

Majority (majority)

Accuracy of classifiers is often compared with the “default accuracy”, that is, the accuracy of a classifier which classifies all instances to the majority class. The training of such classifier consists of computing the class distribution and its modus. The model is represented as an instance of Orange.classification.ConstantClassifier.

class Orange.classification.majority.MajorityLearner

MajorityLearner has two components, which are seldom used.


An estimator constructor that can be used for estimation of class probabilities. If left None, probability of each class is estimated as the relative frequency of instances belonging to this class.


Apriori class distribution that is passed to estimator constructor if one is given.


This “learning algorithm” will most often be used as a baseline, that is, to determine if some other learning algorithm provides any information about the class (

import Orange

monks ="monks-1")

treeLearner = Orange.classification.tree.TreeLearner()
bayesLearner = Orange.classification.bayes.NaiveLearner()
majorityLearner = Orange.classification.majority.MajorityLearner()
learners = [treeLearner, bayesLearner, majorityLearner]

res = Orange.evaluation.testing.cross_validation(learners, monks)
CAs = Orange.evaluation.scoring.CA(res, report_se=True)

print "Tree:    %5.3f+-%5.3f" % CAs[0]
print "Bayes:   %5.3f+-%5.3f" % CAs[1]
print "Default: %5.3f+-%5.3f" % CAs[2]