I have built a Doc2Vec model and am trying to get the vectors of all my testing set (176 points). The code below I can only see one vector at a time. I want to be able to do "clean_corpus[404:]" to get the entire data set but when I try that it still outputs one vector.
model.save(r'F:\LLNL\d2v.model')
print("Model Saved")
from gensim.models.doc2vec import Doc2Vec
model= Doc2Vec.load(r'F:\LLNL\d2v.model')
#to find the vector of a document which is not in training data
test_data = clean_corpus[404]
v1 = model.infer_vector(test_data)
print("V1_infer", v1)
Is there a way to easily iterate over the model to get and save all 176 vectors?
source https://stackoverflow.com/questions/75596881/how-can-i-iterate-through-a-doc2vec-model
Comments
Post a Comment