[Tutor] gensim to generate document vectors
Danny Yoo
dyoo at hashcollision.org
Mon Aug 17 23:09:48 CEST 2015
Followup:
If we want to get at the document vectors after training, I think
that, from reading the code here:
https://github.com/piskvorky/gensim/blob/develop/gensim/models/doc2vec.py#L254
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.
https://github.com/piskvorky/gensim/blob/develop/gensim/models/doc2vec.py#L569
Given that, we should be able to just print out the first vector in
the trained model like this:
print(model.docvecs[0])
More generally, we should be able to do something like:
for index in range(len(model.docvecs)):
print(model.docvecs[index])
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