Annoy#
- class scikitplot.cexternals.annoy.Annoy#
Compiled on GCC. Using 512-bit AVX instructions.
- add_item()#
Adds item
i(any nonnegative integer) with vectorv.Note that it will allocate memory for
max(i)+1items.
- build()#
Builds a forest of
n_treestrees.More trees give higher precision when querying. After calling
build, no more items can be added.n_jobsspecifies the number of threads used to build the trees.n_jobs=-1uses all available CPU cores.
- deserialize()#
Deserializes the index from bytes.
- f#
dimension of vectors
- get_distance()#
Returns the distance between items
iandj.
- get_item_vector()#
Returns the vector for item
ithat was previously added.
- get_n_items()#
Returns the number of items in the index.
- get_n_trees()#
Returns the number of trees in the index.
- get_nns_by_item()#
Returns the
nclosest items to itemi.- Parameters:
search_k – the query will inspect up to
search_knodes.
search_kgives you a run-time tradeoff between better accuracy and speed.search_kdefaults ton_trees * nif not provided.- Parameters:
include_distances – If
True, this function will return a
2 element tuple of lists. The first list contains the
nclosest items. The second list contains the corresponding distances.
- get_nns_by_vector()#
Returns the
nclosest items to vectorvector.- Parameters:
search_k – the query will inspect up to
search_knodes.
search_kgives you a run-time tradeoff between better accuracy and speed.search_kdefaults ton_trees * nif not provided.- Parameters:
include_distances – If
True, this function will return a
2 element tuple of lists. The first list contains the
nclosest items. The second list contains the corresponding distances.
- load()#
Loads (mmaps) an index from disk.
- metric#
metric name
- on_disk_build()#
Build will be performed with storage on disk instead of RAM.
- save()#
Saves the index to disk.
- serialize()#
Serializes the index to bytes.
- set_seed()#
Sets the seed of Annoy’s random number generator.
- unbuild()#
Unbuilds the tree in order to allows adding new items.
build() has to be called again afterwards in order to run queries.
- unload()#
Unloads an index from disk.
- verbose()#