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

📄 filters.py

📁 orange源码 数据挖掘技术
💻 PY
字号:
import orange


############ THIS IS WHAT YOU CAN DO WITH DISCRETE ATTRIBUTES

data = orange.ExampleTable("lenses")

data[0][0] = "?"
data[1][0] = "?"
data[1][1] = "?"

fspec = orange.Filter_isDefined(domain=data.domain)
print "\nCheck all attributes"
print [fspec(ex) for ex in data]

print "\nCheck all attributes (but with 'check' given)"
fspec.check = [1] * len(data.domain)
print [fspec(ex) for ex in data]

print "\nIgnore the first attribute"
fspec.check[0] = 0
print [fspec(ex) for ex in data]

print "\nIgnore the first attribute, check the second (and ignore the rest, list is too short)"
fspec.check = [0, 1]
data[0][3] = "?"
print [fspec(ex) for ex in data]

print "\nAdd the 'age' to the list of the checked"
fspec.check["age"] = 1
print [fspec(ex) for ex in data]

⌨️ 快捷键说明

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