scikitplot.annoy#
scikitplot.annoy#
Public Annoy Python API for scikitplot.
Spotify ANNoy [1] (Approximate Nearest Neighbors Oh Yeah).
This package exposes two layers.
Exports:
Low-level C-extension types copied from Spotify’s annoy project:
AnnoyandAnnoyIndex.A high-level, mixin-composed wrapper
Indexthat:
forwards the complete low-level API deterministically,
adds versioned manifest import/export,
provides explicit index I/O names (
save_index/load_index),provides safe Python-object persistence helpers (pickling),
adds optional NumPy export and plotting utilities,
decides how many threads build an index from one rule (
threads_info,SKPLT_ANNOY_THREADS).
Notes
This module intentionally avoids side effects at import time (no implicit NumPy or matplotlib imports).
See also
scikitplot.cexternals._annoyLow-level C-extension backend.
scikitplot.annoy.IndexHigh-level wrapper composed from mixins.
References
Examples
>>> import random
>>> random.seed(0)
>>> # from annoy import AnnoyIndex
>>> from scikitplot.cexternals._annoy import Annoy, AnnoyIndex
>>> from scikitplot.annoy import Annoy, AnnoyIndex, Index
>>> f = 40 # vector dimensionality
>>> t = Index(f, "angular") # same constructor as the low-level backend
>>> 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 vector search section for further details.
ANNoy (cython based scikitplot/annoy/_annoy)#
ANNoy (Approximate Nearest Neighbors Oh Yeah)
Class inheritance

Annoy Approximate Nearest Neighbors Index. |
ANNoy (cpp based scikitplot/cexternals/_annoy)#
ANNoy (Approximate Nearest Neighbors Oh Yeah)
Class inheritance

Compiled with GCC/Clang. |
|
High-level ANNoy index composed from mixins. |
|
Describe what decides the number of threads in this process. |
ANNoy (cpp based Index Mixins)#
Mixin adding explicit Annoy-native persistence helpers. |
|
Mixin that exports and restores index metadata. |
|
NumPy / SciPy / pandas interoperability for Annoy-like indexes. |
|
Mixin adding pickle support. |
|
Mixin that adds convenient plotting methods to high-level Annoy wrappers. |
|
User-facing neighbor queries for Annoy-like backends. |