source: orange/Orange/doc/reference/pp-select.py @ 9671:a7b056375472

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

Moved orange to Orange (part 2)

Line 
1# Description: Shows how to remove or select examples by values of attributes
2# Category:    preprocessing
3# Classes:     Preprocessor, Preprocessor_take, Preprocessor_drop
4# Uses:        lenses
5# Referenced:  preprocessing.htm
6
7import orange
8data = orange.ExampleTable("lenses")
9age, prescr, astigm, tears, y = data.domain.variables
10
11print "\n\nSelecting examples that have prescription 'hypermetrope' and are 'young' or 'pre-presbyopic'\n"
12pp = orange.Preprocessor_take()
13pp.values[prescr] = "hypermetrope"
14pp.values[age] = ["young", "pre-presbyopic"]
15data2 = pp(data)
16
17for ex in data2:
18    print ex
19
20print "\n\nRemoving examples that have prescription 'hypermetrope' and are 'young' or 'pre-presbyopic'\n"
21pp = orange.Preprocessor_drop()
22pp.values[prescr] = "hypermetrope"
23pp.values[age] = ["young", "pre-presbyopic"]
24data2 = pp(data)
25
26for ex in data2:
27    print ex
Note: See TracBrowser for help on using the repository browser.