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

Revision 9952:986e9cd806f4, 874 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 (manually) select a subset of attributes
2# Category:    preprocessing, feature subset selection
3# Classes:     Preprocessor, Preprocessor_select, Preprocessor_ignore
4# Uses:        lenses
5# Referenced:  preprocessing.htm
6
7import orange
8data = orange.ExampleTable("lenses")
9age, prescr, astigm, tears, y = data.domain.variables
10
11## Preprocessor_select
12
13print "\n\nPreprocessor_select\n"
14pp = orange.Preprocessor_select()
15pp.attributes = [age, tears]
16
17data2 = pp(data)
18print "Attributes: %s, classVar %s" % (data2.domain.attributes, data2.domain.classVar)
19for i in data2[:5]:
20    print i   
21
22## Preprocessor_ignore
23
24print "\n\nPreprocessor_ignore\n"   
25data2 = orange.Preprocessor_ignore(data, attributes = [age, tears])
26print "Attributes: %s, classVar %s" % (data2.domain.attributes, data2.domain.classVar)
27for i in data2[:5]:
28    print i   
29
30
Note: See TracBrowser for help on using the repository browser.