lmcinnes/pynndescent

A Python nearest neighbor descent for approximate nearest neighbors

What it solves

PyNNDescent solves the challenge of finding approximate nearest neighbors efficiently in large datasets, targeting high accuracy rates between 80% and 100%.

How it works

It implements the Nearest Neighbor Descent algorithm for k-neighbor-graph construction, utilizing random projection trees for initialization and graph diversification to prune long edges. It provides a simple interface with two primary operations: building an index on training data and querying that index for nearest neighbors.

Who it’s for

It is built for data scientists and developers looking for a fast, flexible approximate nearest neighbor library that integrates smoothly with scikit-learn and supports a wide variety of distance metrics.

Highlights

  • Easy to install via pip or conda with no platform or compilation issues
  • Supports dozens of distance metrics including Minkowski, spatial, angular, correlation, probability, binary, and custom user-defined metrics
  • Integrates well with scikit-learn as a drop-in replacement via KNeighborTransformer
  • Allows optimization for out-of-distribution queries using query samples

Related

  • Project
  • Project
  • Project
  • Project
  • Project