Like William says, try running the simspeed.py script and paste the
results here.
There are several ways to speed things up with similarity queries in
gensim:
1. submit more queries at once (call `my_index[many_queries]` instead
of `my_index[query]`)
2. install optimized BLAS libraries, see
http://radimrehurek.com/gensim/distributed.html
(although this doesn't help as much with sparse queries, like in
tfidf)
3. use dimensionality reduction -- some latent document
representation, such as LSA, LDA -- instead of plain tfidf
representation.
I have also forked the FLANN repo on github, which promises better
asymptotic complexity for queries. But it doesn't support cosine
similarity, so plugging it in will be non-trivial.
And finally, if you're using a higher-level interface to querying,
such as the similarity server, I have made some improvements there
recently which bring it closer to the raw MatrixSimilarity performance
(less overhead). I plan to release a new version of gensim+simserver
this weekend.
Best,
Radim
On May 18, 3:27 pm, William <
william.b...@gmail.com> wrote:
> Hi Nguyen,
> With some additional information, it might be possible to find ways to
> speed up your queries. Can you clarify whether ~62M words and ~200M
> words refers to unique tokens in your dictionary, or to the total
> number of words (including repeats) in all documents in your entire
> corpora?
>
> What are the specs for the machine you are using? You can benchmark
> your machine by running the command 'python -m gensim.test.simspeed'
> and following the directions. That may give you an indication of
> whether your machine is a bottleneck, or your code/use of gensim.
>
> Have you installed accelerated BLAS libraries on your system? They can
> bring speed benefits.
>
> Are you using the batch query document interface for queries, as
> described on this page?
http://radimrehurek.com/gensim/similarities/docsim.html