source: orange/docs/reference/rst/code/mt-evaluate.py @ 10340:e2b32b9880cb

Revision 10340:e2b32b9880cb, 732 bytes checked in by Lan Zagar <lan.zagar@…>, 2 years ago (diff)

Added multitarget evaluation example.

Line 
1import Orange
2
3data = Orange.data.Table('multitarget-synthetic')
4
5majority = Orange.multitarget.MultitargetLearner(
6    Orange.classification.majority.MajorityLearner(), name='Majority')
7tree = Orange.multitarget.tree.MultiTreeLearner(max_depth=3, name='MT Tree')
8pls = Orange.multitarget.pls.PLSRegressionLearner(name='PLS')
9earth = Orange.multitarget.earth.EarthLearner(name='Earth')
10
11learners = [majority, tree, pls, earth]
12res = Orange.evaluation.testing.cross_validation(learners, data)
13rmse = Orange.evaluation.scoring.RMSE
14scores = Orange.evaluation.scoring.mt_average_score(
15            res, rmse, weights=[5,2,2,1])
16print 'Weighted RMSE scores:'
17print '\n'.join('%12s\t%.4f' % r for r in zip(res.classifier_names, scores))
Note: See TracBrowser for help on using the repository browser.