source: orange/docs/reference/rst/code/scoring-all.py @ 9372:aef193695ea9

Revision 9372:aef193695ea9, 765 bytes checked in by mitar, 2 years ago (diff)

Moved documentation to the separate directory.

Line 
1# Description: Scoring and selection of best N features
2# Category:    feature scoring
3# Uses:        voting
4# Referenced:  Orange.feature.scoring
5# Classes:     Orange.feature.scoring.score_all, Orange.feature.scoring.Relief
6
7import Orange
8table = Orange.data.Table("voting")
9
10def print_best_3(ma):
11    for m in ma[:3]:
12        print "%5.3f %s" % (m[1], m[0])
13
14print 'Feature scores for best three features (with score_all):'
15ma = Orange.feature.scoring.score_all(table)
16print_best_3(ma)
17
18print
19
20print 'Feature scores for best three features (scored individually):'
21meas = Orange.feature.scoring.Relief(k=20, m=50)
22mr = [ (a.name, meas(a, table)) for a in table.domain.attributes ]
23mr.sort(key=lambda x: -x[1]) #sort decreasingly by the score
24print_best_3(mr)
25
26
27
28
Note: See TracBrowser for help on using the repository browser.