source: orange/docs/reference/rst/code/misc-selection-bestonthefly.py @ 9372:aef193695ea9

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

Moved documentation to the separate directory.

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