ml_algo icon indicating copy to clipboard operation
ml_algo copied to clipboard

KDTree query() function returning wrong nearest neighbor

Open rimocell opened this issue 11 months ago • 2 comments

I want to return the nearest neighbor to my data point. However, it is returning the wrong one. I tried returning multiple nearest neighbors and there also seem to be some inconsistencies with the returned list of neighbors.

In the screenshot below, if I return the nearest neighbor, it has distance 8,9. But if I return the two nearest neighbors then it actually returns to me the two nearest ones with distances 2,0 and 3,19.

Screenshot 2024-03-18 at 09 49 11

Also when returning the 3 nearest and the 4 nearest neighbors. On the k=3, the values are wrong

rimocell avatar Mar 22 '24 10:03 rimocell

@rimocell thank you for the report, I'll check the behaviour. Seems like there is a bug.

gyrdym avatar Mar 22 '24 10:03 gyrdym

@rimocell btw, could you please share your data?

gyrdym avatar Mar 22 '24 10:03 gyrdym