scikitplot.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

  • Index → high-level Python subclass (picklable)

  • AnnoyIndex → public aliases of Annoy Index

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

User guide. See the ANNoy section for further details.

ANNoy (Approximate Nearest Neighbors Oh Yeah)#

Annoy

Compiled with GCC/Clang.

AnnoyBase

alias of Annoy

AnnoyIndex

alias of Index

Index

High-level Pythonic Annoy wrapper with picklable (or pickle-able).

ANNoy Mixins#

ManifestMixin

Export/import metadata only.

ObjectIOMixin

Persistence for the Python object (Index/Annoy alias), not the raw Annoy index file.

PathAwareAnnoy

Thin Python subclass that tracks the last known on-disk path.

PickleMixin

Adds strict persistence support.