source: orange/Orange/testing/regression/tests_20/reference_findnearest.py @ 9952:986e9cd806f4

Revision 9952:986e9cd806f4, 737 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Tests moved and renamed from orange 20.

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.