gnes.indexer.chunk.numpy module

class gnes.indexer.chunk.numpy.NumpyIndexer(is_binary=False, *args, **kwargs)[source]

Bases: gnes.indexer.base.BaseChunkIndexer

An exhaustive search indexer using numpy The distance is computed as L1 distance normalized by the number of dimension

add(keys, vectors, weights, *args, **kwargs)[source]

adding new chunks and their vector representations

Parameters:
  • keys (List[Tuple[int, Any]]) – list of (doc_id, offset) tuple
  • vectors (ndarray) – vector representations
  • weights (List[float]) – weight of the chunks
query(keys, top_k, *args, **kwargs)[source]
Return type:List[List[Tuple]]
train(*args, **kwargs)

Train the model, need to be overrided