KristofferC / NearestNeighbors.jl

High performance nearest neighbor data structures (KDTree and BallTree) and algorithms for Julia.
Other
413 stars 65 forks source link

Does ball tree work with any metric? #162

Open EssamWisam opened 1 year ago

EssamWisam commented 1 year ago

It says on the Github readme that ball tree works with any metric; I was using it with a custom metric over discrete vectors (like hamming distance) and noticed that it may be generating centroids that are not discrete; thus, such centroid may be equidistant to all points in hamming space.

KristofferC commented 8 months ago

As long as the triangle inequality is fulfilled it should work in theory. Would have to look at a specific example to say anything more.

EssamWisam commented 8 months ago

It's been some time for me to remember the details of what I was doing but I think was pointing out that my understanding suggests that ball tree doesn't necessarily work for discrete metrics; however, it is mentioned in the README that it works for all metrics.