misc_bestonthefly.py

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

PY
26
字号
import orange, orngMisc

data = orange.ExampleTable("lymphography")

findBest = orngMisc.BestOnTheFly(orngMisc.compare2_firstBigger)

for attr in data.domain.attributes:
    findBest.candidate((orange.MeasureAttribute_gainRatio(attr, data), attr))

print "%5.3f: %s" % findBest.winner()


findBest = orngMisc.BestOnTheFly(callCompareOn1st = True)
for attr in data.domain.attributes:
    findBest.candidate((orange.MeasureAttribute_gainRatio(attr, data), attr))

print "%5.3f: %s" % findBest.winner()

findBest = orngMisc.BestOnTheFly()

for attr in data.domain.attributes:
    findBest.candidate(orange.MeasureAttribute_gainRatio(attr, data))

bestIndex = findBest.winnerIndex()
print "%5.3f: %s" % (findBest.winner(), data.domain[bestIndex])

⌨️ 快捷键说明

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