pp-duplicates.py

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

PY
28
字号
# Description: Shows how to remove or merge duplicate example
# Category:    preprocessing, duplicate examples
# Classes:     Preprocessor, Preprocessor_removeDuplicates, Preprocessor_ignore
# Uses:        lenses
# Referenced:  preprocessing.htm

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

print "\n\nPreprocessor_removeDuplicates\n"

print "Before removal\n"
data2 = orange.Preprocessor_ignore(data, attributes = [age])
for ex in data2:
    print ex

print "After removal\n"
data2, weightID = orange.Preprocessor_removeDuplicates(data2)
# we add a meta attribute so that output is always the same
# (else, the meta id would depend upon the number of meta attributes
# constructed, which would trigger suspicions about randomness in testing scripts
data2.domain.addmeta(weightID, orange.FloatVariable("#"))
for ex in data2:
    print ex


⌨️ 快捷键说明

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