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

📄 exampletable2.py

📁 orange源码 数据挖掘技术
💻 PY
字号:
# Description: Shows how to use ExampleTable.select and ExampleTable.getitems for sampling
# Category:    basic classes, sampling
# Classes:     ExampleTable, MakeRandomIndices, MakeRandomIndicesCV
# Uses:        
# Referenced:  ExampleTable.htm

import orange

domain = orange.Domain([orange.FloatVariable()])
data = orange.ExampleTable(domain)
for i in range(10):
    data.append([i])

for d in data:
    print d,
print "\n"

cv_indices = orange.MakeRandomIndicesCV(data, 4)
print "Indices: ", cv_indices, "\n"

for fold in range(4):
    train = data.select(cv_indices, fold, negate = 1)
    test  = data.select(cv_indices, fold)
    print "Fold %d: train " % fold
    for ex in train:
        print "    ", ex
    print
    print "      : test  "
    for ex in test:
        print "    ", ex
    print

t = data.select([1, 1, 0, 0, 0,  0, 0, 0, 0, 1])
for ex in t:
    print ex

e = data.getitems([0, 1, 9])
for ex in e:
    print ex

⌨️ 快捷键说明

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