source: orange/Orange/doc/reference/cb-filter.py @ 9671:a7b056375472

Revision 9671:a7b056375472, 520 bytes checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

Line 
1# Description: Shows how to derive a class from orange.Filter
2# Category:    filters, preprocessing, callbacks to Python
3# Classes:     Filter
4# Uses:        lenses
5# Referenced:  callbacks.htm
6
7import orange, orngTree, orngMisc
8tab = orange.ExampleTable(r"lenses.tab")
9
10filt = orange.Filter(lambda ex:ex["age"]=="young")
11for e in tab.select(filt):
12    print e
13
14class FilterYoung(orange.Filter):
15    def __call__(self, ex):
16        return ex["age"]=="young"
17
18print "\n"
19for e in tab.select(FilterYoung()):
20    print e
21
22
Note: See TracBrowser for help on using the repository browser.