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

📄 findnearest.py

📁 orange源码 数据挖掘技术
💻 PY
字号:
# Description: Shows how to find the nearest neighbours of the given example
# Category:    basic classes, distances
# Classes:     FindNearest, FindNearestConstructor, FindNearest_BruteForce, FindNearestConstructor_BruteForce
# Uses:        lenses
# Referenced:  FindNearest.htm


import orange

data = orange.ExampleTable("lenses")

nnc = orange.FindNearestConstructor_BruteForce()
nnc.distanceConstructor = orange.ExamplesDistanceConstructor_Euclidean()

did = -42
# Note that this is wrong: id should be assigned by
# did = orange.newmetaid()
# We only do this so that the script gives the same output each time it's run
nn = nnc(data, 0, did)

print "*** Reference example: ", data[0]
for ex in nn(data[0], 5):
    print ex

⌨️ 快捷键说明

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