_annoy#
High-level Python interface for the C++ ANNoy backend.
Spotify ANNoy [0] (Approximate Nearest Neighbors Oh Yeah).
Exports:
Annoy → low-level C-extension type (stable) c-api powered new features
AnnoyIndex → alias of Annoy (legacy AnnoyIndex name)
References
Examples
>>> import random; random.seed(0)
>>> # from annoy import Annoy, AnnoyIndex
>>> from scikitplot.cexternals._annoy import Annoy, AnnoyIndex
>>> from scikitplot.annoy import Annoy, AnnoyIndex, Index
>>> f = 40 # vector dimensionality
>>> t = AnnoyIndex(f, "angular") # Length of item vector and metric
>>> t.add_item(0, [1] * f)
>>> t.build(10) # Build 10 trees
>>> t.get_nns_by_item(0, 1) # Find nearest neighbor