[Tutor] gensim to generate document vectors

Danny Yoo dyoo at hashcollision.org
Mon Aug 17 23:09:48 CEST 2015


If we want to get at the document vectors after training, I think
that, from reading the code here:


that you want to get at the model's 'docvecs' attribute.  We know it's
a DocvecArray because it is assigned here in the model.


Given that, we should be able to just print out the first vector in
the trained model like this:


More generally, we should be able to do something like:

    for index in range(len(model.docvecs)):

to get at the vectors for all the trained documents.

That being said, I have not executed any of this code on my machine.
I'm only going by reading, so I might be misinterpreting something.
Hence the suggestion to talk to folks who have actually used the
library.  :P

More information about the Tutor mailing list