Questions tagged [python-annoy]

4 questions
13
votes
1 answer

How to use the spotify's annoy library in python?

I want to know how the annoy library works. I got this test code from github but I'm new to coding, so it is difficult for me to understand . from annoy import AnnoyIndex import random f = 40 t = AnnoyIndex(f, 'angular') #Length of item vector…
Anchita Goswami
  • 131
  • 1
  • 1
  • 4
2
votes
0 answers

Fail to build index with large datasets, seems to take infinite time

I used annoy to build an index for 2 million vectors of size 1024. Here is the code that I used. f = 1024 t = AnnoyIndex(f, 'euclidean') t.on_disk_build('test.ann') '''code for adding 2 million vectors''' t.build(25) After adding vectors,…
Janaka
  • 481
  • 4
  • 14
1
vote
0 answers

AnnoyIndex(length, 'angular') from annoy library python returns euclidean distance instead of angular

I am trying to implement the ANNOY library in python. I have the following code, which runs fine: from annoy import AnnoyIndex class GeneratorAnnoy: def __init__(self, vector_dict: dict): self.vector_dict = vector_dict …
0
votes
0 answers

multiprocessing, adding Items to Annoy Index

I am trying to use Spotify's Annoy for processing a 200K volume dataset. Sine the dataset is huge, I am trying to use multiprocessing. I constantly get the "cannot pickle annoy object" error. I changed my code to add the items to the annoy index…
P Ved
  • 109
  • 3
  • 13