# Changeset 4060:5e021a849cac in orange

Ignore:
Timestamp:
08/07/07 14:16:25 (7 years ago)
Branch:
default
Convert:
3de681725a3c3f6d7cd44c4e36d54682aeb817a7
Message:

changed description for evaluation, added one more example

File:
1 edited

Unmodified
Removed
• ## orange/doc/ofb/regression.htm

 r2826 classifiers, and evaluation techniques are not much different either.

Few Simple Regressors

Let us start with Learner        MSE default         862.838 regression tree 53.378 k-NN (k=5)      23.285

Currently, mean squared error is the only evaluation function we provide for regression. If you need to implement something more advanced or meaningful for your data, you should check how MSE is implemented in orngStat: it really takes only about a single line of code to compute this statistics, so you should have no problems implementing your scoring functions.

default         84.777 regression tree 40.096 k-NN (k=5)      17.532

Other scoring techniques are available to evaluate the success of regression. Script below uses a range of them, plus features a nice implementation where a list of scoring techniques is defined independetly from the code that reports on the results.

part of regression4.py (uses housing.tab)

lr = orngRegression.LinearRegressionLearner(name="lr") rt = orngTree.TreeLearner(measure="retis", mForPruning=2, minExamples=20, name="rt") maj = orange.MajorityLearner(name="maj") knn = orange.kNNLearner(k=10, name="knn") learners = [maj, lr, rt, knn] # evaluation and reporting of scores results = orngTest.learnAndTestOnTestData(learners, train, test) scores = [("MSE", orngStat.MSE), ("RMSE", orngStat.RMSE), ("MAE", orngStat.MAE), ("RSE", orngStat.RSE), ("RRSE", orngStat.RRSE), ("RAE", orngStat.RAE), ("R2", orngStat.R2)] print "Learner  " + "".join(["%-7s" % s[0] for s in scores]) for i in range(len(learners)): print "%-8s " % learners[i].name + "".join(["%6.3f " % s[1](results)[i] for s in scores])

Here, we used a number of different scores, including:

• MSE - mean squared errror
• RMSE - root mean squared error
• MAE - mean absolute error
• RSE - relative squared error
• RRSE - root relative squared error
• RAE - relative absolute error
• R2 - coefficient of determinatin, also referred to as R-squared

For precise definition of these measures, see orngStat documentation. Running the script above yields:

Learner  MSE    RMSE   MAE    RSE    RRSE   RAE    R2 maj      84.777  9.207  6.659  1.004  1.002  1.002 -0.004 lr       23.729  4.871  3.413  0.281  0.530  0.513  0.719 rt       40.096  6.332  4.569  0.475  0.689  0.687  0.525 knn      17.244  4.153  2.670  0.204  0.452  0.402  0.796

Note: See TracChangeset for help on using the changeset viewer.