source: orange/docs/reference/rst/code/mlc-evaluate.py @ 9505:4b798678cd3d

Revision 9505:4b798678cd3d, 855 bytes checked in by matija <matija.polajnar@…>, 2 years ago (diff)

Merge in the (heavily modified) MLC code from GSOC 2011 (modules, documentation, evaluation code, regression test). Widgets will be merged in a little bit later, which will finally close ticket #992.

Line 
1import Orange
2
3def print_results(res):
4    loss = Orange.evaluation.scoring.mlc_hamming_loss(res)
5    accuracy = Orange.evaluation.scoring.mlc_accuracy(res)
6    precision = Orange.evaluation.scoring.mlc_precision(res)
7    recall = Orange.evaluation.scoring.mlc_recall(res)
8    print 'loss=', loss
9    print 'accuracy=', accuracy
10    print 'precision=', precision
11    print 'recall=', recall
12    print
13
14learners = [Orange.multilabel.MLkNNLearner(k=5)]
15data = Orange.data.Table("emotions.tab")
16
17res = Orange.evaluation.testing.cross_validation(learners, data)
18print_results(res)
19
20res = Orange.evaluation.testing.leave_one_out(learners, data)
21print_results(res)
22
23res = Orange.evaluation.testing.proportion_test(learners, data, 0.5)
24print_results(res)
25
26reses = Orange.evaluation.testing.learning_curve(learners, data)
27for res in reses:
28    print_results(res)
Note: See TracBrowser for help on using the repository browser.