KristofferC / NearestNeighbors.jl

High performance nearest neighbor data structures (KDTree and BallTree) and algorithms for Julia.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BruteTree SemiMetric support

zgornel opened this issue · comments

BruteTrees are a simple structure that can support ::Distances.SemiMetric. Is there any reason for which these are not allowed? Im obviously referring to the cosine distance which is a very popular choice in many applications.

A minimal example would be:

bt = BruteTree(rand(2,10), CosineDist())  # currently fails
idxs, dists = knn(bt, rand(2))

A - quickly found - reference regarding kdtrees.