NearestNeighbors.jl icon indicating copy to clipboard operation
NearestNeighbors.jl copied to clipboard

Does ball tree work with any metric?

Open EssamWisam opened this issue 2 years ago • 2 comments

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.

EssamWisam avatar Aug 08 '23 19:08 EssamWisam

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.

KristofferC avatar Dec 27 '23 11:12 KristofferC

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.

EssamWisam avatar Dec 27 '23 16:12 EssamWisam