source: orange/Orange/testing/regression/tests_20/reference_pp-select.py @ 9952:986e9cd806f4

Revision 9952:986e9cd806f4, 869 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Tests moved and renamed from orange 20.

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.