pp-attributes.py

来自「orange源码 数据挖掘技术」· Python 代码 · 共 31 行

PY
31
字号
# 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 + =
减小字号Ctrl + -
显示快捷键?