source: orange/docs/reference/rst/code/misc-selection-bestonthefly.py @ 10654:cd73789785b5

Revision 10654:cd73789785b5, 1.0 KB checked in by markotoplak, 2 years ago (diff)

Moved selection from misc to utils.

Line 
1# Description: Demonstrates the use of BestOnTheFly class from Orange.utils.selection
2# Category:    utils, selection
3# Classes:     BestOnTheFly
4# Uses:        lymphography.tab
5# Referenced: 
6
7import Orange
8
9lymphography = Orange.data.Table("zoo")
10
11find_best = Orange.utils.selection.BestOnTheFly(call_compare_on_1st=True)
12
13for attr in lymphography.domain.attributes:
14    find_best.candidate((Orange.feature.scoring.GainRatio(attr, lymphography), attr))
15
16print "%5.3f: %s" % find_best.winner()
17
18find_best = Orange.utils.selection.BestOnTheFly(Orange.utils.selection.compare_first_bigger)
19
20for attr in lymphography.domain.attributes:
21    find_best.candidate((Orange.feature.scoring.GainRatio(attr, lymphography), attr))
22
23print "%5.3f: %s" % find_best.winner()
24
25find_best = Orange.utils.selection.BestOnTheFly()
26
27for attr in lymphography.domain.attributes:
28    find_best.candidate(Orange.feature.scoring.GainRatio(attr, lymphography))
29
30best_index = find_best.winner_index()
31print "%5.3f: %s" % (find_best.winner(), lymphography.domain[best_index])
Note: See TracBrowser for help on using the repository browser.