Mean (mean)ΒΆ

Accuracy of a regressor is often compared with the accuracy achieved by always predicting the average value. The “learning algorithm” computes the average and represents it with a regressor of type Orange.classification.ConstantClassifier.

Examples

The following example compares the mean squared error of always predicting the average with the error of a tree learner.

mean-regression.py:

import Orange

housing = Orange.data.Table("housing")

treeLearner = Orange.classification.tree.TreeLearner() #Orange.regression.TreeLearner()
meanLearner = Orange.regression.mean.MeanLearner()
learners = [treeLearner, meanLearner]

res = Orange.evaluation.testing.cross_validation(learners, housing)
MSEs = Orange.evaluation.scoring.MSE(res)

print "Tree:    %5.3f" % MSEs[0]
print "Default: %5.3f" % MSEs[1]