Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong answer #18

Open
APernatii opened this issue Nov 18, 2024 · 6 comments
Open

wrong answer #18

APernatii opened this issue Nov 18, 2024 · 6 comments

Comments

@APernatii
Copy link

So, Im not sure what is happening, but I try to use the following stuff

using Neighborhood
using Distances
queryPoint = [2.0,1.0]
dataX = [0.5 0.5; 1.5 0.5]
tree = Neighborhood.searchstructure(KDTree,dataX,Euclidean(),reorder = false)
idx,ds = Neighborhood.knn(tree, queryPoint, nonearpoints)

And I got the answer
idx,ds = Neighborhood.knn(tree, queryPoint, nonearpoints)
([1, 2], [1.5811388300841898, 1.5811388300841898])

that is clearly whong, because if I check the distance
Euclidean()(queryPoint ,dataX[2,:])
I got the answer: 0.7071067811865476

What am I doing wrong here? Please help

@Datseris
Copy link
Member

can you run this again without the reoder = false keyword?

@APernatii
Copy link
Author

same answer

@Datseris
Copy link
Member

in your original code nonearpoints is undefined.

@APernatii
Copy link
Author

Sorry
nonearpoints = 2

@Datseris
Copy link
Member

Unfortunately I don't think I can help you because this doesn't appear to be an interface problem (Neighborhoods.jl only provodes the interface). What I would recomend is that you reproduce this using NearestNeighbors.jl directly, and open an issue there. The developers will have better chances understanding what is wrong.

@APernatii
Copy link
Author

Oh, I see, Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants