All Projects → dillondaudert → NearestNeighborDescent.jl

dillondaudert / NearestNeighborDescent.jl

Licence: MIT license
Efficient approximate k-nearest neighbors graph construction and search in Julia

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to NearestNeighborDescent.jl

adventures-with-ann
All the code for a series of Medium articles on Approximate Nearest Neighbors
Stars: ✭ 40 (+17.65%)
Mutual labels:  nearest-neighbors, approximate-nearest-neighbor-search
dist
🗺️ Python/C API extension module that computes distance between two coordinates on the world map
Stars: ✭ 13 (-61.76%)
Mutual labels:  distance
OmniSci.jl
Julia client for OmniSci GPU-accelerated SQL engine and analytics platform
Stars: ✭ 22 (-35.29%)
Mutual labels:  julialang
deoplete-julia
deoplete.nvim source for julia. Providing julia Syntax Completions for julia, in Neovim (deprecated for julia 0.6+)
Stars: ✭ 12 (-64.71%)
Mutual labels:  julialang
PosDefManifold.jl
A Julia package for manipulating data in the Riemannian manifold of positive definite matrices
Stars: ✭ 23 (-32.35%)
Mutual labels:  distance
TIFUKNN
kNN-based next-basket recommendation
Stars: ✭ 38 (+11.76%)
Mutual labels:  nearest-neighbors
stringosim
String similarity functions, String distance's, Jaccard, Levenshtein, Hamming, Jaro-Winkler, Q-grams, N-grams, LCS - Longest Common Subsequence, Cosine similarity...
Stars: ✭ 47 (+38.24%)
Mutual labels:  distance
Julia
Algorithms implemented in the Julia programming language. We're collaborating with the Humans of Julia community!
Stars: ✭ 216 (+535.29%)
Mutual labels:  julialang
similarity measures
Quantify the difference between two arbitrary curves in space
Stars: ✭ 140 (+311.76%)
Mutual labels:  distance
skyline-query
Simple implementation of spatial skyline query algorithms
Stars: ✭ 17 (-50%)
Mutual labels:  nearest-neighbors
FaceDetection.jl
A face detection algorithm using Viola-Jones' rapid object detection framework written in Julia
Stars: ✭ 13 (-61.76%)
Mutual labels:  julialang
FLANN.jl
A Julia wrapper for Fast Library for Approximate Nearest Neighbors (FLANN)
Stars: ✭ 14 (-58.82%)
Mutual labels:  nearest-neighbors
setup-julia
This action sets up a Julia environment for use in actions by downloading a specified version of Julia and adding it to PATH.
Stars: ✭ 56 (+64.71%)
Mutual labels:  julialang
product-quantization
🙃Implementation of vector quantization algorithms, codes for Norm-Explicit Quantization: Improving Vector Quantization for Maximum Inner Product Search.
Stars: ✭ 40 (+17.65%)
Mutual labels:  approximate-nearest-neighbor-search
geojson-python-utils
Python helper functions for manipulating GeoJSON
Stars: ✭ 86 (+152.94%)
Mutual labels:  distance
erkir
Երկիր (Erkir) - a C++ library for geodesic and trigonometric calculations
Stars: ✭ 26 (-23.53%)
Mutual labels:  distance
FstFileFormat.jl
Julia bindings for the fst format
Stars: ✭ 17 (-50%)
Mutual labels:  julialang
annoy.rb
annoy-rb provides Ruby bindings for the Annoy (Approximate Nearest Neighbors Oh Yeah).
Stars: ✭ 23 (-32.35%)
Mutual labels:  approximate-nearest-neighbor-search
MicroLogging.jl
A simple logging API for julia
Stars: ✭ 26 (-23.53%)
Mutual labels:  julialang
fastknn
Fast k-Nearest Neighbors Classifier for Large Datasets
Stars: ✭ 64 (+88.24%)
Mutual labels:  nearest-neighbors

NearestNeighborDescent.jl

Documentation Build Status

A Julia implementation of Nearest Neighbor Descent.

Dong, Wei et al. Efficient K-Nearest Neighbor Graph Construction for Generic Similarity Measures. WWW (2011).

Overview

Nearest Neighbor Descent (NNDescent) is an approximate K-nearest neighbor graph construction algorithm that has several useful properties:

  • general: works with arbitrary dissimilarity functions
  • scalable: has an empirical complexity of O(n^1.14) pairwise comparisons for a dataset of size n
  • space efficient: the only data structure required is an approximate KNN graph which is operated on in-place and is also the final output
  • accurate: converges to above 90% recall while only comparing each data point to a small percentage of the whole dataset on average

NNDescent is based on the heuristic argument that a neighbor of a neighbor is also likely to be a neighbor. That is, given a list of approximate nearest neighbors to a point, we can improve that list by exploring the neighbors of each point in the list. The algorithm is in essence the repeated application of this principle.

Installation

]add NearestNeighborDescent

Basic Usage

Approximate kNN graph construction on a dataset:

using NearestNeighborDescent
using Distances
data = [rand(20) for _ in 1:1000]
n_neighbors = 10
metric = Euclidean()
graph = nndescent(data, n_neighbors, metric)

The approximate KNNs of the original dataset can be retrieved from the resulting graph with

# return the approximate knns as KxN matrices of indexes and distances, where
# indices[j, i] and distances[j, i] are the index of and distance to node i's jth
# nearest neighbor, respectively.
indices, distances = knn_matrices(graph)

To find the approximate neighbors for new points with respect to an already constructed graph:

queries = [rand(20) for _ in 1:20]
n_neighbors = 5
indices, distances = search(graph, queries, n_neighbors)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].