⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pp-select.py

📁 orange源码 数据挖掘技术
💻 PY
字号:
# Description: Shows how to remove or select examples by values of attributes
# Category:    preprocessing
# Classes:     Preprocessor, Preprocessor_take, Preprocessor_drop
# Uses:        lenses
# Referenced:  preprocessing.htm

import orange
data = orange.ExampleTable("lenses")
age, prescr, astigm, tears, y = data.domain.variables

print "\n\nSelecting examples that have prescription 'hypermetrope' and are 'young' or 'pre-presbyopic'\n"
pp = orange.Preprocessor_take()
pp.values[prescr] = "hypermetrope"
pp.values[age] = ["young", "pre-presbyopic"]
data2 = pp(data)

for ex in data2:
    print ex

print "\n\nRemoving examples that have prescription 'hypermetrope' and are 'young' or 'pre-presbyopic'\n"
pp = orange.Preprocessor_drop()
pp.values[prescr] = "hypermetrope"
pp.values[age] = ["young", "pre-presbyopic"]
data2 = pp(data)

for ex in data2:
    print ex

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -