_annoy#
High-level Python interface for the C++ Annoy backend.
Spotify Annoy (Approximate Nearest Neighbors Oh Yeah).
Exports:
Annoy → low-level C-extension type (stable)
AnnoyBase → alias of annoylib.Annoy Index
AnnoyIndex → alias of annoylib.Annoy Index
Note
See also
References
Examples
>>> # from annoy import AnnoyIndex
>>> from scikitplot.annoy import Annoy, AnnoyBase, 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