source: orange/Orange/doc/reference/findnearest.py @ 9671:a7b056375472

Revision 9671:a7b056375472, 737 bytes checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

Line 
1# Description: Shows how to find the nearest neighbours of the given example
2# Category:    basic classes, distances
3# Classes:     FindNearest, FindNearestConstructor, FindNearest_BruteForce, FindNearestConstructor_BruteForce
4# Uses:        lenses
5# Referenced:  FindNearest.htm
6
7
8import orange
9
10data = orange.ExampleTable("lenses")
11
12nnc = orange.FindNearestConstructor_BruteForce()
13nnc.distanceConstructor = orange.ExamplesDistanceConstructor_Euclidean()
14
15did = -42
16# Note that this is wrong: id should be assigned by
17# did = orange.newmetaid()
18# We only do this so that the script gives the same output each time it's run
19nn = nnc(data, 0, did)
20
21print "*** Reference example: ", data[0]
22for ex in sorted(nn(data[0], 5)):
23    print ex
Note: See TracBrowser for help on using the repository browser.