sukri12 / pysal

Automatically exported from code.google.com/p/pysal
Other
0 stars 0 forks source link

Bug in knnApproxW (and probably DistanceBands) #126

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
knnApproxW is not returning enough points in some cases.

The current strategy is to query for k points, then we call 
kd_tree.query_ball_point with the distance of the k'th point.  The idea being 
that we'll get all points within the same distance as the k'th point (in the 
case of ties).  Unfortunately kd_tree.query_ball_point is not (always?) 
returning points on the threshold.  We cannot safely add an small error margin 
without checking the results.

This probably a bug in DistanceBands as well since kd_tree.query_ball_point is 
used.

Original issue reported on code.google.com by schmi...@gmail.com on 5 Jan 2011 at 7:08

GoogleCodeExporter commented 8 years ago
Add unit test using latticeshapefile. Set threshold to 1 and check number of 
returned neighbors.

Original comment by sjsrey on 7 Jan 2011 at 9:25

GoogleCodeExporter commented 8 years ago
Bug is caused by Int vs Float numbers.  When input points are floats 
kd_tree.query_ball_point will return the correct results.  

If input points are integers kd_tree.query_ball_point will return oddly 
selective points.
I'm running scipy.version.version, '0.8.0'

Original comment by schmi...@gmail.com on 20 Jan 2011 at 12:46

GoogleCodeExporter commented 8 years ago
See revision r712 for test.

Original comment by schmi...@gmail.com on 20 Jan 2011 at 12:47

GoogleCodeExporter commented 8 years ago
bug report submitted to scipy-dev@scipy.org

http://mail.scipy.org/pipermail/scipy-dev/2011-January/015894.html

Original comment by schmi...@gmail.com on 20 Jan 2011 at 1:32

GoogleCodeExporter commented 8 years ago
Work around added in Distance.py in r713

All points will be cast to floats.  We should follow the progress in 
scipy.spatial and remove this work around when the bug is fixed (and enough 
people have upgrade scipy).

Closing as resolved.

Original comment by schmi...@gmail.com on 20 Jan 2011 at 1:48