I’d like to announce Neighborhood.jl, a new Julia package that has the following purpose: Provide a unified API for finding nearest (or approximately nearest) neighbors in Julia. The API is exceptionally simple (documentation):
- Initialize the search structure by calling
ss = searchstructure(TheTypeToUse, data, metric).
- Use it for making searches with
search(ss, query, searchtype, ...; ...)
searchtypeis one of two types:
NeighborNumber(::k). Shorthands to
- Other methods that may (or may not) offer performance benefits depending on the type of
ssare also provided.
Progress on this has been extremely slow, but I grew tired of constantly re-inventing the wheel at JuliaDynamics and constantly re-writing interfaces for NearestNeighbors.jl so Neighborhood.jl was published.
I documented the package as well as I could, and there is an example interfacing of KDTrees, with every single method being (to the best of my knowledge) the most performant possible. It is only my hope now that the community will feel compelled to interface more packages into Neighborhood.jl
Having many packages in Neighborhood.jl is exceptionally useful for the scientific community. @JonasIsensee has done a small project where he has measured different packages and how they perform, and depending on the dimensionality of your data, how they are structured in their state space, how many searches you want, and how many searches you need to do in bulk, and whether you need filtering, it is not obvious which packages should be the fastest for your application. Neighborhood.jl allows you to immediately and trivially swap a nearest neighbor finding package in your algorithm by changing a single argument:
TheTypeToUse (which could be
If you would like to contribute, that would be amazing. This issue lists packages that offer nearest (or approximately nearest) neighbor searching in Julia, and would be great to interface any of them. I’ve added a “Dev Docs” page in the documentation to make this easy.