[Tutor] sorting distances for nearest neighbor

Danny Yoo dyoo at hashcollision.org
Fri Aug 29 21:24:46 CEST 2014


> How do you sort distances to prepare for nearest neighbor when the results
> returned look like this from the below statements?


It's unclear what you're asking.


1.  Are you showing us the file content in the raw form:

> Distance from 1 to
> 16 is 43763.0757603
> 19 is 126516.988978
> 18 is 131011.694135
[text cut]

and you're asking how to parse the content that you presented?

2.  Or are you asking how to use the sort routines in Python?

3.  Or are you asking how to write nearest neighbor?

4.  Or are you asking for something else?  I have no idea how to
interpret what you mean by:

    DR=distance(n,XCOORDINATE, YCOORDINATE, IDCODE)
    DZ=switch(n,XCOORDINATE, YCOORDINATE, IDCODE)

in your problem statement, given you don't say what DR, distance,
switch, n, or IDCODE are.  So I don't understand the terms being used
in large portions of your problem statement.


The question you're presenting has much more ambiguity than I'm
comfortable with.  Rather than try to cover all the bases, if you can
scope the request to something more manageable, it'll probably make it
easier to answer.   Please clarify.  Thanks!


More information about the Tutor mailing list