select_backend#

scikitplot.corpus.select_backend(name='auto', *, index_kwargs=None, annoy_metric='angular', annoy_n_trees=10, annoy_search_k=-1, annoy_impl='auto', annoy_dtype=None, annoy_index_dtype=None, **kwargs)[source]#

Construct an ANN backend by name.

Parameters:
namestr or VectorIndexBackend subclass, optional

"auto" (default) resolves the first available backend in DEFAULT_BACKEND_ORDER. An explicit built-in name is honoured or raises if unavailable. A custom VectorIndexBackend subclass may be supplied directly.

index_kwargsmapping, optional

Generic constructor keyword arguments for the selected backend. New code should prefer this mapping instead of adding backend-specific parameters to RetrievalConfig.

annoy_metric, annoy_n_trees, annoy_search_k, annoy_impl, annoy_dtype, annoy_index_dtype

Backward-compatible Annoy constructor settings. They are merged only when the resolved backend is AnnoyBackend; generic index_kwargs win over default legacy values.

**kwargsAny

Compatibility form for generic backend constructor keyword arguments. Conflicting keys between index_kwargs and kwargs raise.

Returns:
VectorIndexBackend

An unbuilt backend instance.

Raises:
ValueError

If name is not a known backend or "auto".

RuntimeError

If an explicitly named backend is unavailable, or if "auto" finds no available backend (numpy missing).

Parameters:
  • name (Any)

  • index_kwargs (Mapping[str, Any] | None)

  • annoy_metric (str)

  • annoy_n_trees (int)

  • annoy_search_k (int)

  • annoy_impl (str)

  • annoy_dtype (str | None)

  • annoy_index_dtype (str | None)

  • kwargs (Any)

Return type:

VectorIndexBackend