📄 pp-attributes.py
字号:
# Description: Shows how to (manually) select a subset of attributes
# Category: preprocessing, feature subset selection
# Classes: Preprocessor, Preprocessor_select, Preprocessor_ignore
# Uses: lenses
# Referenced: preprocessing.htm
import orange
data = orange.ExampleTable("lenses")
age, prescr, astigm, tears, y = data.domain.variables
## Preprocessor_select
print "\n\nPreprocessor_select\n"
pp = orange.Preprocessor_select()
pp.attributes = [age, tears]
data2 = pp(data)
print "Attributes: %s, classVar %s" % (data2.domain.attributes, data2.domain.classVar)
for i in data2[:5]:
print i
## Preprocessor_ignore
print "\n\nPreprocessor_ignore\n"
data2 = orange.Preprocessor_ignore(data, attributes = [age, tears])
print "Attributes: %s, classVar %s" % (data2.domain.attributes, data2.domain.classVar)
for i in data2[:5]:
print i
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -